- 25 Apr 2023
- 1 Minute to read
- Print
- DarkLight
Add a Compare action button
- Updated on 25 Apr 2023
- 1 Minute to read
- Print
- DarkLight
To add and enable a Compare action button, you must:
- Create a Lightning component
- Create the action button
- Drop the action button on the object layout
- Add the action button to the Lightning record page
Create a Lightning component
Go to Developer Console > File > New > Lightning Component.
In the New Lightning bundle dialog, in the Name field, enter a custom name for your component.
Select Submit.
Replace the .cmp markup file with the following:
<aura:component access="global" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId"> <zpl:ScenarioCompareAction scenarioConfigurationNickname="<Unique Nickname of the Scenario Configuration>" recordId="{!v.recordId}"/> </aura:component>
Replace the value for the Unique Nickname of the Scenario Configuration attribute with the nickname of the scenario configuration you want to use.
Save the component.
Create the Compare action button
- From the Setup interface in the customer's org, go to Object Manager and select your header object.
- In the Buttons, Links and Actions section, select New Action.
- In the Label and Name fields, enter Compare.
- From the Action Type dropdown, choose Lightning Component.
- From the Lightning Component dropdown, choose the name of the component you created in Create a Lightning component.
- In the Height field, specify 250px.
- Select Save.
Drop the action button on the object layout
- Go to Page Layouts for this object and select a layout.
- In the Mobile & Lightning Actions section, find the Compare action button.
- Drag it to the correct place in the layout.
- Select Save.
Add the action button to the Lightning record page
If the Lightning record page is using dynamic forms, you must also add the action to the Lightning record page.