1

I have a lightning component that is supposed to refresh the record page. I have it implemented as an action in a visual flow, but it returns the following error:

"Error element Refresh_Record_Page (FlowActionCall). We can't execute this action. Ask your admin to check that the "c:refreshRecordPage" Lightning component's client-side controller includes an "invoke" method and that My Domain is enabled and deployed for your org."

Here is the code for my lightning component:

Component:

<aura:component implements="lightning:availableForFlowActions">
   <aura:handler event="aura:locationChange" action="{!c.update}"/> 
</aura:component>

Controller:

({
 update : function (component, event, helper) {
  // Get the new location token from the event if needed
  var loc = event.getParam("token");
  $A.get('e.force:refreshView').fire();
}

})

1 Answer 1

1

You can use update screen component for this https://unofficialsf.com/the-update-screen-flow-action-component/

create a lightning component

<aura:component implements="lightning:availableForFlowActions,force:hasRecordId" access="global">


    <aura:attribute name="recordError" type="String"
                    description="An error message bound to force:recordData"/>

    <force:recordData aura:id="recordLoader"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordError}"
                      />

</aura:component>

js

({
    invoke : function(component, event, helper) {        
        return new Promise(function(resolve, reject) {
            component.find("recordLoader").reloadRecord(true, $A.getCallback(function() {
                // ignore errors, we don't want to stop the flow if we cannot refresh the record
                resolve();
            }));
        });
    }
})

design

<design:component >
    <design:attribute name="recordId" label="RecordId"/>
    <design:attribute name="recordError" label="RecordError"/>
</design:component>
10
  • Can you please explain what the recordError should be from the flow. I tried to call this lightning action from the flow but it doesnt refresh the page
    – user81642
    Commented Apr 14, 2020 at 17:43
  • @user81642 nothing just the "recordId" attribute
    – User6670
    Commented Apr 14, 2020 at 18:10
  • Can you please help me with the salesforce.stackexchange.com/questions/302508/… The lightning component called in the flow doesnot refresh the page
    – user81642
    Commented Apr 14, 2020 at 18:55
  • @user81642 i think it will only work if the flow screen is on record page
    – User6670
    Commented Apr 14, 2020 at 19:27
  • I am calling the screen flow from the button. Sorry I am not following you
    – user81642
    Commented Apr 14, 2020 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .