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 = Jul 15, 2016 at 16:03

1 Answer 1

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'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .