Skip to main content

Adding a Lightning Button

Navigate to the entity you wish to add the button to, note that you will have to add the button to each entity individually.

Once on the desired entity page find the settings icon in the top right corner and select Edit Page.

Entity page settings gear menu with Setup, Developer Console, Edit Page, and Edit Object options, Edit Page highlighted

On the left-hand side of the page in the Lightning Components section scroll to the bottom of the page until you find the InRule_RunRules in the Custom-Managed Section

Custom (0) section showing No components available

Custom - Managed (1) section showing the InRule_RunRules component

If you have not setup your Salesforce domain, you will see this message in the Custom-Managed Section.

Simply follow the link to setup your domain. Once it has been set and you have logged in with the new domain come back to edit page and you should now see the InRule_RunRules Lightning Component.

Drag the window to the desired location on the page view. Once you have placed the component, click on it and a menu bar on the right will appear three two available configuration values.

InRule_RunRules component configuration panel with Rule Application Name, RuleSet Name(s), and Rule Application Label(s) fields

The first configuration field, Rule Application Name, allows you to define a Rule Application to use for this specific lightning component. Placing a value in this field will override the Rule Application you have defined in your Custom Setting as the default. Leave this field blank to use the default configured Rule Application.

The "Rule Set Name(s)" field accepts a comma delimited list of Rule Set names. Adding multiple rule sets here will create multiple Run Rules buttons for each defined Rule Set on the page. Leaving this field blank will leave only the singular "Run Rules" button, and this button will execute the Default Rule Set for the given entity. The Default Rule Set is defined as the entity's name + "DefaultRules." For example, if you are adding the Lightning component to the Account entity, the Rule Set name it will default to if this field is left blank is "AccountDefaultRules."

If no Rule Sets are defined, will create 1 button that uses the default Rule Set for the entity:

Page layout preview showing the InRule component with a single Run Rules button

If one Rule Set is defined, will create 1 button that will use that defined Rule Set:

Page layout preview showing the InRule component with the RuleSet Name(s) field set to Rule1 and a single Run Rules button

If 2+ Rule Sets are defined, will create a button per Rule Set that will use the defined Rule Sets.

Page layout preview showing the InRule component with the RuleSet Name(s) field set to Rule1, Rule2 and two buttons titled Rule1 and Rule2

The last configuration field accepts a comma-delimited list of Rule Application Labels. This allows for overriding the Rule Application Label defined on the Rule Execution Service and providing users the ability to change what label to run rules against from the defined list of options.

When no Rule Application Labels are defined, the Run Rules button appears as normal and rules will be executed against the label configured on the Rule Execution Service:

Rule Application Label(s) field left blank, with a single Run Rules button

If one Rule Application Label is defined, the Run Rules button appears as normal and rules will be executed against that defined label:

Rule Application Label(s) field set to Label1, with a single Run Rules button

If more than one label is defined, a dropdown box will appear underneath the Run Rules button that allows users to select what label to run rules against. All defined Rule Sets and their associated buttons will execute against the selected label:

Rule Application Label(s) field set to Label1, Label2, with a Run Rules button and a Rule Application Label dropdown showing Label1

Once you have configured these fields, click save in the top right corner. It will prompt you to activate this page to make it visible to your users, click activate.

Page Saved dialog prompting to activate the page, with Not Yet and Activate buttons

Salesforce will now ask for the scope to activate the record page. Select the desired scope and click Assign and then save on the subsequent prompt.

Activation: Account Record Page dialog with Org Default, App Default, and App Record Type and Profile tabs, and Assign as Org Default button highlighted

Navigate back to the main entity page and the component should appear.

Account record page in Salesforce showing the InRule Run Rules button in the sidebar