Loading
Visual Studio Code Based Modeler for Consumer Goods Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Add Display Record Created with the Wizard to the Master List

          Add Display Record Created with the Wizard to the Master List

          After you create display records with the wizard, use Visual Studio Code based Modeler to add and append the new display records to the parent list of displays. We do this by adding and configuring the myAddItem method.

          Required Editions

          Available in: Enterprise and Unlimited Editions where Consumer Goods Cloud is enabled
          User Permissions Needed
          To configure methods in VS Code Modeler Customizer, Developer
          1. To create the myAddItem method, open the VS Code terminal, run the sf mdl add command and enter these details.
            ? Select the resource you want to add. businesslogic
            ? Specify a name for the businesslogic: AddItem
            ? Select the module to which businesslogic 'AddItem' should be added. MyDisplay
            ? Select a suitable option for businesslogic 'AddItem'. method
            ? Select the reference object to which you want to add the businesslogic method. LoMyDisplay
            ? Do you really want to create the businesslogic 'AddItem'? Yes
            Successfully created businesslogic 'AddItem'.
            The CLI creates the LoMyDisplays.MyAddItem.bl.js contract and adds a reference to this method in listObject in the LoMyDisplays.listobject.xml contract.
          2. In LoMyDisplays.MyAddItem.bl.js, add this code.
            let iconId='Shelf_Lime';
            if (Utils.isTrue(newDisplayDetail.getCompetitorDisplay())) iconId='Shelf_Dark_Orange';
            var liMyNewDisplay ={
            pKey: newDisplayDetail.getPKey(),
            name: newDisplayDetail.getName(),
            description: newDisplayDetail.getDescription(),
            competitorDisplay: newDisplayDetail.getCompetitorDisplay(),
            iconId: iconId,
            }
            me.addListItems([liMyNewDisplay]);
            me.setCurrentByPKey(liMyNewDisplay.getPKey());
          3. Save your changes.
          4. To check for validation errors, build the contracts by running this command: sf modeler workspace build
           
          Loading
          Salesforce Help | Article