0

I'm using a script and windows.open function to go to a specific URL when a user click a button on the VFpage. Something is going wrong because after the click the same page is reloaded.

SCRIPT:

<script type="text/javascript">
 function goback()
 {
   window.open(retURL);
 }
</script>

Inside the retURL variable, there is the URL where I want to go, something like: https://eu6.salesforce.com/0015800000DuQWsAAN'

button:

<apex:commandButton action="{!deleteContract}" value="Elimina Contratto e prodotti selezionati" immediate="true"  onclick= "goback()" />
    </apex:pageBlockButtons>

How can I solve this problem?

1
  • try window.location.href = – Ilya Lepesh Jul 15 '16 at 16:03
0

If you are using controller then better to navigate from the controller method. Do not use javascript for this.

In the last line of the method write like this:

return (new ApexPages.StandardController (new SObject(Id='0015800000DuQWsAAN'))).view(); 

replace the SObject with the name of specific object for which your recordId is '0015800000DuQWsAAN'

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.