7

I have an auto launched flow that updates the Status of the Case to be closed when the button is clicked. The flow is like below enter image description here

I am calling the flow through the Detail Page Button using the URL like

/flow/Close_Case_Autolaunched?recordId={!Case.Id}&retURL={!Case.Id}

With the return URL set after the flow completed it does return back to the Page but the page is not refreshed it just shows old status and when manually do a refresh it shows the Closed status. The flow does update the record but but the page is not being refreshed. How can we handle this

8 Answers 8

9

Unfortunately, the UnofficialSF solution didn't work for me, but was able to get a similar solution working.

Similar to the UnofficialSF component, add the following aura component to your flow where you want the refresh to occur.

RefreshView.cmp
<aura:component implements="lightning:availableForFlowActions,force:hasRecordId">
    <!-- no markup needed -->
</aura:component>
RefreshViewController.js
({
    invoke : function(component, event, helper) {
        $A.get('e.force:refreshView').fire();
    }
})

Add it to your flow as shown below; takes no inputs. Should be good to go after this.

enter image description here

1
  • I wanted to refresh Screen Flow after file upload. Your Aura Component didn't seem to work
    – compski
    Commented Sep 8, 2023 at 7:14
5

Yes, you are not able to trigger the action for the Update Screen from an auto launched flow, but a workaround is to create a Screen Flow with just 1 action for the Update Screen and nothing else. Then in your button url have the retURL reference the Screen Flow with the Update Screen first, then add another retURL for the record! This worked perfectly for me and shows the refreshed screen!

Example for the Button:

/flow/Account_Copy_Address?recordID={!Account.Id}&retURL=/flow/Update_Record_Screen?recordID={!Account.Id}&retURL=/lightning/r/Account/{!Account.Id}/view

1
  • Don't understand where you put the button URL? Is it on the record detail page or Flow Button?
    – compski
    Commented Sep 8, 2023 at 7:04
3

This can be solved using a component from Unofficial SF (which is managed by the SFDC Flow PM)

The component is Update Screen

Add it as the last element of your flow

enter image description here

There's lots of cool stuff at Unofficial SF that makes flows work better and more user-friendly

5
  • 2
    i think this wont work for autolaunched flow ?
    – User6670
    Commented Apr 3, 2020 at 7:30
  • Can you make it a simple screen flow with just a Display Text element?
    – cropredy
    Commented Apr 3, 2020 at 14:03
  • Simple display text, do you mean like a toast? I am trying to minimize the user clicks can we have the display text with no user clicks ?
    – user81642
    Commented Apr 6, 2020 at 9:56
  • No, I meant a Screen that says something like "You are about to do xxxx, press Next to continue"
    – cropredy
    Commented Apr 7, 2020 at 3:14
  • @cropredy I tried using this component in my flow but i dont get the record page refreshed I posted the question here salesforce.stackexchange.com/questions/302508/… can you please help me what I am missing
    – user81642
    Commented Apr 14, 2020 at 19:09
1

I think Adding a Confirmation Screen at the end ("User can click 'finish' which will refresh the flow) and Also Adding a Screen in the beginning with something like "Press Next to Continue" will solve this.

1

unfortunately none of these solutions worked for me from the start. But by combining all of the solutions together, I was able to refresh the record page after closing the screen flow.

What I did:

  1. I Have created LWC with disconnectedCallback();
    disconnectedCallback() {
        window.location.reload();
    }
  1. I left html empty;
<template>
</template>
  1. I have placed this component in screen flow

enter image description here

0

Hello Salesforce Ohana!

If this questions is still open, please check the approach below. To refresh the screen/page at the end of the flow or after clicking the Finish button, follow the steps below.

  1. Create an Aura Component
  2. Add the extesions needed in the CMP file(lightning:availableForFlowActions in this case). PFA supporting screenshot.
  3. Add the Invoke method with just a line. PFA supporting screenshot.
  4. Add this component in the flow as the last element. Use Action flow element for the same. Drag the Action element and add Aura Component created in #1. PFA supporting screenshot.
  5. Save and Activate the flow

Now, whenever the flow ends, the page would be refreshed successfully.

enter image description here

enter image description here

enter image description here

Thanks in advance. Please let me know when it works!

2
  • 2
    Firstly, please do not post code as screenshots - it is not as accessible to users who use screen readers or other assistive technology. Plus it makes it harder for anyone to copy/use your code. Instead, type or copy/paste the code into the SFSE editor & format it as a code block. Secondly, your answer is very similar to Charles Naccio's answer - the (only seemingly significant) difference being that in the controller you call window.location.reload() rather than $A.get('e.force:refreshView').fire();. It would be helpful if you could elaborate on how your option is better/different.
    – Moonpie
    Commented Jul 7, 2022 at 11:56
  • This one worked for me as soon as I exchanged $A.get('e.force:refreshView').fire(); for window.location.reload(); in the JS Controller. It works perfectly when you have the screenflow embedded in the page (means as a component on the page) but when you have the flow as an action then it will refresh the oage but start the screen flow right away. So as long as you use the flow as an embedded component it should do what you want. Commented Jan 12, 2023 at 15:35
0

I had a similar request, and the LWC https://unofficialsf.com/update-screen/ component work for some use cases but it was not working for mine. Why?

I am launching a screen flow from a Object Button/Action. So the Update-screen component from unofficialsf would refresh the highlights panel, but not the information below.

  1. I would click the blue button
  2. The green area would get refreshed.
  3. The red area would not get refreshed. The red area renders other screen flows.

enter image description here

How I solved it? Using the 'Navigate Everywhere Action' twice. I would first navigate to any other related object, and immediately to the same current record that I was displaying. That made it work.

enter image description here

enter image description here

0

Actually If you are using quick action then after completion it will by default call the quick action so here inside aura component i call window.replace to navigate to page directly. Add this component in the flow as the last element.

<aura:component implements="force:lightningQuickAction,lightning:availableForFlowActions"><aura:attribute name="recordId" type="String" /></aura:component>



({    
invoke : function(component, event, helper) {
    // Get the record ID attribute
    var record = component.get("v.recordId");
    
    // Get the Lightning event that opens a record in a new tab
    var redirect = $A.get("e.force:navigateToSObject");
    
    // Pass the record ID to the event
    redirect.setParams({
        "recordId": record
    });
    
    // Open the record
    //redirect.fire();
    
    //window.setTimeout(function(){ window.location.reload()}, 500);
    var origin = location.origin;
      window.location.replace(origin+"/"+record);
},

})

You must log in to answer this question.

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