0

I have a custom button which calls the VisualForce page from where a flow is called, we used this approach because calling the flow directly from the URL button was not refreshing the parent record screen in lightning.

Custom button URL is like /apex/SFRequest?&id={!Case.Id} where SF Request is the VF Page

VF Page

<apex:page standardController="Case" lightningStylesheets="true">
   <flow:interview name="S_R_Case" finishLocation="/{!$CurrentPage.parameters.Id}"> 
     <apex:param name="var_CaseId" value="{!Id}" />  
   </flow:interview>
</apex:page>

where S_R_Case is the flow, I do have finish screen in the end of the flow. Was hoping when the finish button is clicked on the screen the VF Page will help the page to be navigate with the page refreshed, it didnot refresh.

I also tried to add the extension to VF Page like

public class RefreshPagefromVF {
    
    public ApexPages.StandardSetController stdControl{get; set;}
    
    public RefreshPagefromVF(ApexPages.StandardSetController controller) {
        stdControl = controller;
    }
    
    
    public Flow.Interview.S_R_Case theFlow { get; set; }
    
    public PageReference getRecordPage(){
        if(theFlow == null)
            return null;
        else
            return new PageReference('/' + theFlow.caseRecId);
    }
}

And changed the VFPage like

<apex:page standardController="Case" tabStyle="Case" Extensions="RefreshPagefromVF" recordSetVar="cases" lightningStylesheets="true">
   <flow:interview name="S_R_Case" interview="{!theFlow}"  finishLocation="{!RecordPage}"> 
     <apex:param name="var_CaseId" value="{!Id}" />  
   </flow:interview>
</apex:page>

This didnot help either, it does come back to the case record page but data is not synced. How to refresh the page here , is there something I am missing here.

P.N : We cannot use Quick Actions in our Case Page layouts because of the feed tracking we enabled, so that option is rolled out for us.

1

UnofficialSF has an action I've used in the past. These are the pieces of the Lightning Component that make it work. This could be added as the last step of your Flow. https://unofficialsf.com/update-screen/

Component

<!--

 Copyright (c) 2018, salesforce.com, inc.
 All rights reserved.

 Licensed under the BSD 3-Clause license.
 For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause

-->
<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

/*
 * Copyright (c) 2018, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
({
    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

<!--

 Copyright (c) 2018, salesforce.com, inc.
 All rights reserved.

 Licensed under the BSD 3-Clause license.
 For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause

-->
<design:component >
    <design:attribute name="recordId" label="RecordId"/>
    <design:attribute name="recordError" label="RecordError"/>
</design:component>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.