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
          Configure an Add Button to the Master Detail Page

          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
          1. In Visual Studio (VS) Code based Modeler, add this code snippet to the PageHeader section 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>
          2. Save your changes.
          3. Add these codes to the respective sections of MyDisplay_DisplayDetailsUI.processflow.xml.
            1. 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"/>
            2. Add this snippet to the Events section of the view action of the process.
              <Event name="addDisplay" action="LoadDisplayDetails.create"/>
            3. Add this snippet to the DetailObject section 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>
            4. Save your changes.
          4. To check for validation errors, build the contracts by running this command: sf modeler workspace build.
           
          Loading
          Salesforce Help | Article