function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
softcloud2009softcloud2009 

Close Pop Up and Refresh SFDC page

Hi All,

 

I have a custom button which will call my custom .NET app in the pop up window. What I would like to do is when user close that pop up window it will automatically refresh the SFDC page which initiated this call. How can we do that?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
shillyershillyer

Yes - the id is the current record you are viewing when you click on the button. This way the function knows what page to reload.

 

Best,

Sati

All Answers

softcloud2009softcloud2009
Anyone ever worked in this issue before...
shillyershillyer

In your Visualforce page, you'll want to call a JavaScript function that will close the pop-up and refresh the parent opener.

 

        function closeRefresh(id) { 
top.parent.window.opener.location.href = "/"+id;
top.parent.window.close();
}

Your Visualforce page can call this from a button and pass the current record id.

 

<apex:commandButton onclick="javascript:closeRefresh('{!ObjectRecord.Id}');" value="Close"/> 

Hope that helps,

Sati

softcloud2009softcloud2009

Hi,

 

I thank you for the response. I assume that it will work the same in .NET because I am not using VisualForce, instead I am using .NET app as in the pop up window.

 

So, I have to pass the record id. Which record is it? Is it based on which page I am opening the pop up from such as opportunity page, contact page, etc.?

 

Thanks.

shillyershillyer

Yes - the id is the current record you are viewing when you click on the button. This way the function knows what page to reload.

 

Best,

Sati

This was selected as the best answer
rajarakrajarak

But, this way of accessing the native SFDC page from Visualforce page is not working.

Since they both are in different domains, we are unable to reach to the SFDC page that triggered the VF page.

 

Please let me know if there is a workaround to refresh the SFDC page after closing the VF page.

 

Thanks