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
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.
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());
Save your changes.
To check for validation errors, build the contracts by running this command: sf
modeler workspace build
Did this article solve your issue?
Let us know so we can improve!
Loading
Salesforce Help | Article
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.