You need to sign in to do that
Don't have an account?
Sonya Dhand 3
Return to Original Page when Clicking on Custom Button?
Hi
I have a custom button on Case object that when clicked on starts a flow . What I want to do is close the pop up window when the flow finishes and return to the orignal page which is refreshed so the record is updated with the new data .
I have this code on my button which is calling a flow and the following vf page forceclose to close the window but now I need it to refresh the page. It is currently refreshing the home page and not the page where i call the flow from i.e my Case record
And my button custom button code is
I have a custom button on Case object that when clicked on starts a flow . What I want to do is close the pop up window when the flow finishes and return to the orignal page which is refreshed so the record is updated with the new data .
I have this code on my button which is calling a flow and the following vf page forceclose to close the window but now I need it to refresh the page. It is currently refreshing the home page and not the page where i call the flow from i.e my Case record
<apex:page showChat="false" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false"> <html> <head> <title>ESCAPE</title> <script> function closeWindow(){ window.opener.location.href="/{!$CurrentPage.parameters.id}"; window.top.close(); } </script> </head> <body onload="closeWindow()"> </body> </html> </apex:page>
And my button custom button code is
/flow/Restart_Case_Milestones?CaseID={!Case.Id}&retURL=https://cs86.salesforce.com/{!Case.Id}
/flow/Restart_Case_Milestones?CaseID={!Case.Id}&retURL=/{!Case.Id}
Actually the code for my custom button is calling the vf page to close the pop up window , but once this is closed I want the whole page to refresh so the new data inputted by the flow can be seen by the user without them having to manaually refresh
/flow/Restart_Case_Milestones?CaseID={!Case.Id}&retURL=/apex/forceclose
Because of cross domain issues with a standard page and visualforce page, you can't refresh the standard parent page from the child visualforce page.
If you must open the flow in a new window, the only way I have found to accomplish the refresh is to embed the flow in a visualforce page that has the close behavior on finish in it. Then for your custom button, use an onclick javascript button that launches the child window and on an interval, checks if that child window is closed and if it is, then it will refresh the page. Example of javascript button below:
{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')}
var sfid = "{!Case.Id}";
window.childWin = window.open('/apex/VFPAGENAMEe?id=' + sfid, 'VFPAGENAME', 'height=450,width=1500,location=yes,menubar=no,status=no,toolbar=no');
window.intervalId = window.setInterval('window.checkIfChildWindowIsClosed()', 5*1000);
//add check function to window
window.checkIfChildWindowIsClosed = function()
{
if(window.childWin.closed)
{
window.clearInterval(window.intervalId);
window.parent.location.href = window.parent.location.href;
}
}