Lightning Visualforce Page Redirection Refresh Issue

19.02.2020
|
0 Comments
||
|

Introduction

Lightning Experience is a next-level experience in Salesforce and has a major improvisation in functionality, usability, and speed for every user type. You can use aura components and apps to fulfil your requirements in lightning but as there are pros of lightning, there are still some bugs in it. One of them is – the lightning record doesn’t show the refreshed data after redirection from a visualforce page. So a solution for it is creating an empty aura component and add the “refresh View” function in it so that whenever the page is opened the aura component gets called and the view gets refreshed.

Here is an example:
Make an aura component named ‘RefreshView’(you can name it whatever you want). Add the following lines in

RefreshView.cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
</aura:component>

RefreshViewController.js

handleInit : function(component, event, helper) {
setTimeout(function(){
$A.get('e.force:refreshView').fire();
}, 1);
}

After you have added the above lines in the component and saved it, you have to add the component in your record layout. To achieve this you will have to click on the settings icon on the top right and select the Edit page from it. Then search the component name(RefreshView) from the left side menu and then drag and drop it to the required layout. In the end, click save and if it shows a popup to activate please select the option accordingly and you are done.

img

There can be more than one-page layout being used for a particular record type. To check this you will have to click on the ‘details’ section in the ‘Edit Page’ and then it will show up the list in the right-hand side column. You can either add the component to the required layout or to all the layouts depending on your requirement.

For testing, you will have to go to the record page in which you have added the component and want the changes to show up. Click on the button which opens up the related visualforce page and make the changes. Once you get redirected back to the record page you will be able to see the changed data which wasn’t showing up correctly before adding the component.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share on:
Share this...
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Website security
Contact Us