Flow Screen Component that triggers a Next Best Action refresh when the flow is run.

  1. Open Salesforce Developer Console and create a new Lightning Component

E.g. FireNbaRefreshEvent component:

Component (.cmp) file:

<aura:component implements= “force:hasRecordId,forceCommunity:availableForAllPageTypes,flexipage:availableForAllPageTypes,lightning:availableForFlowScreens”

               access=”global”>

   <aura:registerEvent name=”refreshEvent” type=”markup://lightning:nextBestActionsRefresh”/>

   <aura:handler name=”init” value=”{!this}” action=”{!c.doInit}”/>

   <aura:attribute name=”myRecordId” type=”String” />

</aura:component>

Controller (.js) file:

({

doInit : function(component, event, helper) {

       var appEvt = $A.get(“e.lightning:nextBestActionsRefresh”);

       appEvt.setParam(“recordId”, component.get(“v.myRecordId”));

       appEvt.fire();

}

})

Design (.design) file:

<design:component>

   <design:attribute name=”myRecordId” />

</design:component>

  1. Add Lightning Component the flow by adding it to a screen as a “Field” of type “lightning component”. You need to have the flow pass {!contextRecordId} as an input attribute. For example, implement a flow where the first step updates a field on the context record and the 2nd step is a screen which includes the lightning component.