Custom Button Documentation
1) Create Button Collection Variable(s)
Create Button Collection Variable: To configure custom buttons for a flow screen first create a new flow resource with a Data Type of "Apex-Defined" and Apex Class set to "FlowToolKit_Button". This resource must also be marked as "Allow multiple values (collection)". This collection will be passed to the Form (Buttons) screen component. If your solution requires multiple sets of buttons, create multiple button collection variables, one for each business case. Note: a single button collection can be referenced within multiple screen components. Additional button collection variables are only required if different types of buttons are required.
2) Add New Buttons to the Button Collection
Buttons are configured and added to the button collection variable via an Apex Action labeled "Add New Button". Drag a new action element onto the flow composer and search for "Add New Button". The Add New Button custom property editor which is outlined below provides an interface for building custom flow buttons. See the documentation and demo component below for more details.
It is important to note that new buttons are added to the button collection variable by setting the Button Collection selector to the related button collection variable . The Add New Button action returns a "buttons" output value which includes the newly configured button.
The order in which buttons are configured within the flow composer, is the order in which the buttons will be displayed within the flow screen component. The example above shows that the "Submit Form Button" will be the first button displayed, follwed by the "Update Contact(s) Button", then the "Reset Values Button", and finally the "Save and New Button".
Add New Button (Custom Property Editor)
Add New Button (Action)
The component below will allow you to test configuring a custom button to be used within flow screen components. Be sure to reference the Button Preview section for a live preview of the configured button and optional modal.
Note: click the button to preview modal message configuration.
3) Configure Custom Screen Components
Drag and drop either the Form (Buttons) or the Form (Header) component onto the flow screen. Reference the Form (Buttons) documentation outlined below for configuration details.
Custom Screen Components
Form (Buttons)
Assign Output Variable
The Form (Buttons) component returns an output value that includes the information about the button that was clicked. Store this value within a flow resource and use it within a decision element when applicable.
Form (Buttons) Documentation
Select Buttons
- Button Collection
- Assign a flow resource value with a Data Type of "Apex-Defined" and Apex Class set to "FlowToolKit_Button". This resource must also be marked as "Allow multiple values (collection)".
Button Display Configuration
- Button Display Type
- Standard: when selected the buttons are display as floating buttons without any special formatting.
- Footer: when selected the buttons are displayed within a formatted block footer. See Below.
- Docked Footer: when selected buttons are fixed within a formatted block footer at the bottom of the page.
- Button Alignment: aligns the buttons within the compenent to the left, right or center of the screen.
- Number of Buttons to display: defines the total number of visible buttons. If the Button Collection includes more buttons than this value additional buttons will be assigned to a button menu at the end of the component. The following example has a collection with 4 buttons. Number of Buttons to display was set to 2, the other two buttons are accessible from within the drop down menu.
- Group Buttons: when enabled all buttons are displayed as a button group without any spacing between buttons. For more information reference the lightning component developer guide.
Flow Buttons Demo
Custom buttons are displayed within flow screens via the Form (Buttons) component or the Form (Header) component. The following examples demo how the Form (Buttons) component can display buttons on the screen. The header above which is configured with the Form (Header) component also allows administrators to assign a collection custom buttons.
Form (Buttons) can be aligned to the left, right or center of the screen.
Display Buttons as Grouped or Spaced.
This example shows spaced out buttons.
Form (Buttons) can be configured to show a specified number of buttons.
All other buttons will be added to a button menu.
Form (Buttons) can Display buttons with multiple variants.
see lightning-button documentation for more details
click button below to learn more!