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
chandrashekar Jangitichandrashekar Jangiti 

Hi i need to have help "I created VFpage and i return javascript like below but when am clicking on CANCEL and SAVE buttons it is not redirecting to Same record page

Hi i need to have help "I created VFpage and i return javascript like below but when am clicking on CANCEL and SAVE buttons it is not redirecting to Same record page.."

my script in VFpage:
<script language="JavaScript" type="text/javascript">
        function CloseAndRefresh(){
            window.opener.location.href="/{!$CurrentPage.parameters.OppId}"; 
            window.top.close();
            }
    </script>

and buttons:
<apex:commandButton action="{!saveCurrentStep}" value="Save" oncomplete="javascript:CloseAndRefresh()" status="Status"  />
            
           <apex:commandButton action="{!CancelCurentStep}" value="Cancel" oncomplete="javascript:CloseAndRefresh()"  />

So..here i need  below methods need to be execute..so i need below entire code foe save and cancel..
public void SaveCurrentStep(){
}
and 
public Void CancelCurentStep{
}

VamsiVamsi
Hi,

Is the Javascript keyword specifed intentionally in the below line ?

oncomplete="javascript:CloseAndRefresh()" 
chandrashekar Jangitichandrashekar Jangiti
Yes Vamsi..
 
VamsiVamsi
If you have your code in this way then it should work oncomplete="CloseAndRefresh();"