4

I have a visualforce page with following code:

<apex:outputlink value="{!URLFOR($Action.Custom_Object__c.Edit, id_of_object,[retURL=URLFOR($Page.The_page)])}" >Edit</apex:outputlink>

When I click on the link in Lightning, a pop-up window appears for edit object. The window is standard action. If I close it the visualforce page does not refresh.

What do I need to do for refresh visualforce page?

0

In your visualforce page use a javaScript method to call it in apex:outputlink on oncomplete event and render apex:outputlink based on ui themes. Like Them4d for Lightning, Theme3 for classic ui and Theme4t for salesforce1 mob app.

Function refresh(){
sforce.one.back(true);
}

call it on oncomplete of apex:outputlink: as

<apex:outputlink value="{!URLFOR($Action.Custom_Object__c.Edit, id_of_object,[retURL=URLFOR($Page.The_page)])}" oncomplete="return refresh()" rendered="{!$User.UITheme == 'Theme4d'}">Edit</apex:outputlink>

It will give you a refreshed view in lightning mode.

Remember to write another block of code for rendering the same output link in classic other wise you will not be able to see the outputLink in classic mode.

    <apex:outputlink value="{!URLFOR($Action.Custom_Object__c.Edit, id_of_object,[retURL=URLFOR($Page.The_page)])}" oncomplete="return refresh()" rendered="{!$User.UITheme == 'Theme3'}">Edit</apex:outputlink>

Reference:-

If it still does not give you a refreshed view, then add another method to redirect to edited record id using this:-

navigateToSObject(​recordId​[, view]) or navigateToURL(​url​[, isredirect])

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.