6

Calling a flow from Quick Action wasnt refreshing the screen , so I calling the Update Screen action from the https://unofficialsf.com/the-update-screen-flow-action-component/. Quick Action updates the owner of the case record to be the current through the flow. After the case is updated I see the screen like

enter image description here

Instead of showing the screen at the end of flow finishes, is there a way we can automatically close it through the Update Screen lightning component. I will save the user the key clicks every time they try to update something. I tried to add $A.get('e.force:refreshView').fire(); which would do complete refresh but I still see that screen Component of the Update Screen

<aura:component implements="lightning:availableForFlowActions,force:hasRecordId">
    <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>

Controller

({
    invoke : function(component, event, helper) {        
        return new Promise(function(resolve, reject) {           
component.find("recordLoader").reloadRecord(true, $A.getCallback(function() {
                $A.get('e.force:refreshView').fire();
                resolve();
            }));
        });
    }})

Can anyone suggest me any options for closing flow screen automatically through the lightning component here.

1 Answer 1

6

You have available Flow Navigation Actions to you in the aura component.

enter image description here

You need to use these to control the flow execution. It seems the unofficialSF component is a flow action. You can simply add another flow screen that uses an aura component that will essentially auto-finish for you and implements lightning:availableForFlowScreens.

<aura:component implements="lightning:availableForFlowScreens,force:hasRecordId">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>
({
   doInit: function(component, event, helper) {
      var navigate = component.get("v.navigateFlow");
      navigate("FINISH");
   }
})
6
  • Yea I understand adding the finish button would resolve. It will again be an extra click for the user to close the screen right, I am checking with out an extra screen/ click if there is a way to close the screen from lightning component
    – user81642
    Jan 8, 2021 at 16:13
  • It doesn't have to be a click, you can call the navigate whenever you'd like so it doesn't need user intervention. My example uses an example of a button as that's the typical use case, but you can navigate whenever you'd like as far as I know. Jan 8, 2021 at 16:19
  • Thank you, Can you please give an example of how to navigate from the Update Screen lightning component
    – user81642
    Jan 8, 2021 at 17:39
  • I'm not familiar with that unofficialSF component. I edited where I think it would work but cannot confirm/test myself Jan 8, 2021 at 17:58
  • Thank you for your effort.. Yeah it is failing Error in $A.getCallback() [navigate is not a function]
    – user81642
    Jan 8, 2021 at 18:19

You must log in to answer this question.

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