The Flow-Enabled Version of the Next Best Actions Lightning Component

Install Unmanaged Package

The Next Best Action lightning component, affectionately known by the NBA team as the NBA widget, executes NBA Strategies and displays the resulting recommendations on pages:

Einstein Next Best Action is the Salesforce decisioning layer that complements Flow, and it’s free to try. Learn more here.

This component can be used programmatically as a component in Aura-based lightning component applications. In this regard, it’s identical to all of the base components at https://developer.salesforce.com/docs/component-library/overview/components

To use the component, invoke it in your aura container like this:

Note that the lightning:availableForFlowScreens is only necessary if you want the component to appear in a Flow Screen.

You can see in the example the attributes that are publicly available:

strategyNameString required=”true” access=”GLOBAL” description=”The unique name of the recommendation strategy to execute.”
recordIdStringaccess= “GLOBAL” description=”ID of the current record being viewed.”
orientationStringaccess=”GLOBAL” default=”vertical” description=”Whether to display the propositions horizontally or vertically. Valid values are vertical and horizontal” />
maxPropositionsInteger access=”GLOBAL” default=”4″ description=”The maximum number of propositions to display.” Important: if you pass a null value to this field, Salesforce will fail with a cryptic error message.
labelStringaccess=”GLOBAL” description=”Text to display as the header for the component.”/>

In the above example, the wrapping component uses the lightning:availableForFlowScreens interface. This causes the NBA component to be available in Flow Builder to be added to screens:

View Source Code