1

Is it possible to close a child window and redirect back to the Parent Page from a VF page? I have a VF page that is used by a Quick Action. I would like to close the window after the user closes the alert message. I've tried both 'window.self.close();' and 'window.top.close();' and neither had any effect on the page.

<apex:page showHeader="false" standardController="Account" 
standardStylesheets="false" sidebar="false" applyHtmlTag="false" 
applyBodyTag="false" docType="html-5.0">
<apex:form >

<apex:includeScript value="/soap/ajax/36.0/connection.js"/>
<apex:includeScript value="/soap/ajax/36.0/apex.js"/>

<script type="text/javascript">

function testRemote()
    {
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        try {

            var retId; 
            retId = sforce.apex.execute("CallABCWebServiceAccountUpdate", "ABCWebServiceAccountUpdate", {id:'{!Account.Id}'}); 

            alert('The Account information has been updated to the Database. Click "OK" and then select the "Cancel" button to get back to the Account');            
            } 
         catch(e)            
         {
           alert('Exception'+e)
         }
    }
  • I was able to get the page to close placing sforce.one.navigateToSObject('{!Account.Id}'); just above the alert in the VF page. But when the Alert is closed and the Account Page renders it appears that the page shakes side to side a couple times. Does anyone know what this is about? – Michael May 14 '18 at 18:44
  • I have also been able to use 'Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"false"}}); with the ill effects of sforce.one.navigateToSObject('{!Account.Id}'); . But the Account page still refreshes even when I have refresh set to false. When going back to the parent record always force a page refresh in the Mobile application? – Michael May 14 '18 at 18:50

Your Answer

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

Browse other questions tagged or ask your own question.