You are here:
Configure an Add Button to the Master Detail Page
Use Visual Studio Code based Modeler to add a button on the Master Detail dialog and trigger an event to open the Add Display wizard. When a user taps the Create button on the user interface, the Master-Detail process starts the Create wizard.
Required Editions
| Available in: Enterprise and Unlimited Editions where Consumer Goods Cloud is enabled |
| User Permissions Needed | |
|---|---|
| To add a button action in master layout in VS Code Modeler | Customizer, Developer |
-
In Visual Studio (VS) Code based Modeler, add this code snippet to the
PageHeadersection of the user interface in MyDisplay_MyDisplayDetailsUI.userinterface.xml.This code snippet creates the AddDisplay menu item, which is always visible. It includes bindings for a text label with the default value Add Display and an icon image with the ID Plus_PB. The menu item also has an event listener for when the button is pressed, triggering the addDisplay event.<MenuItems> <MenuItem directlyVisible="true" itemId="AddDisplay"> <Bindings> <Resource target="Text" type="Label" id="AddDisplay" defaultLabel="Add Display"/> <Resource target="Icon" type="Image" id="Plus_PB" /> </Bindings> <Events> <ButtonPressedEvent event="addDisplay" /> </Events> </MenuItem> </MenuItems> - Save your changes.
-
Add these codes to the respective sections of
MyDisplay_DisplayDetailsUI.processflow.xml.
-
Add this snippet to the Declaration section.
<Declaration name="Name" type="DomText" /> <Declaration name="Description" type="DomLongDescription" /> <Declaration name="CompetitorDisplay" type="DomBool" /> <Declaration name="Type" type="DomDisplayType"/> -
Add this snippet to the Events section of the view action of the process.
<Event name="addDisplay" action="LoadDisplayDetails.create"/> -
Add this snippet to the
DetailObjectsection of the MASTER_DETAIL_HANDLER Action of the process.This code snippet includes various return values such as name, description, competitor display, and type. The autoSave attribute is set to FALSE, indicating that the wizard process won't automatically save any changes.<Create autoSave="FALSE"> <WizardProcess name="MyDisplay::MyCreateNewWizardProcess" submitParameter="ProcessContext::AddDisplay_ButtonPressed"> <ReturnValues> <Return name="ProcessContext::Name" value="Name" /> <Return name="ProcessContext::Description" value="Description" /> <Return name="ProcessContext::CompetitorDisplay" value="CompetitorDisplay" /> <Return name="ProcessContext::Type" value="Type" /> <Return name="ProcessContext::AddDisplay_ButtonPressed" value="buttonPressed" /> </ReturnValues> </WizardProcess> </Create> - Save your changes.
-
Add this snippet to the Declaration section.
-
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!

