Add a New Scenario action button
  • 25 May 2023
  • 1 Minute to read
  • Dark
    Light

Add a New Scenario action button

  • Dark
    Light

Article summary

To add and enable a New Scenario action button, you must:

Create a copy directive

  1. Go to Setup > Custom Code > Custom Metadata Types.

  2. On the Copy Directive row, select Manage Records, then select New.

  3. In the Copy Directive Name field, enter zdm_agreeScenarioDirective.

  4. In the Copy Directive JSON field, define fields to be copied.

    Tip

    You can use the JSON body of the Simple_PriceLookup_Copy directive and make necessary changes to it.

  5. Select Save.

Create a Lightning component

  1. Go to Developer Console > File > New > Lightning Component.

  2. In the New Lightning bundle dialog, in the Name field, enter a custom name for your component.

  3. Select Submit.

  4. Replace the .cmp markup file with the following:

    <aura:component access="global"         implements="force:lightningQuickActionWithoutHeader,force:hasRecordId">
    
        <zpl:CreateScenarioModal copyDirectiveLabel="<Label of the Copy Directive>"
            recordId="{!v.recordId}"/>
    
    </aura:component>
    
  5. Replace the value for the Label of the Copy Directive attribute with the label of the copy directive you created.

  6. Save the component.

Create the New Scenario action button

  1. From the Setup interface in the customer's org, go to Object Manager and select your header object.
  2. In the Buttons, Links and Actions section, select New Action.
  3. In the Label and Name fields, enter New Scenario.
  4. From the Action Type dropdown, select Lightning Component.
  5. From the Lightning Component dropdown, select the name of the component you created in Create a Lightning component.
  6. In the Height field, specify 650px.
  7. Select Save.

Drop the action button on the object layout

  1. Go to Page Layouts for this object and select a layout.
  2. In the Mobile & Lightning Actions section, find the New Scenario action button.
  3. Drag it to the correct place in the layout.
  4. Select Save.

Add the action button to the Lightning record page

If the Lightning record page is using dynamic forms, you must add the action to the Lightning record page.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.