im trying to create a Back button on a standard page which will take the user back to a custom visual force page with multiple parameters in the URL, i have brought through the two values i require into the standard page however im struggling to access them.

i first tried: /apex/ProductOrderManip?ProductOrderId={!ProductOrder__c.Id}&ProductOrderId={!Project__c.Id}"

which came back with blank values when clicking on the button.. ive just tried something similar to this but struggled to get it to work correctly

    function gup( name )
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
    return results[1];


2 Answers 2


You can try to use URLFOR function that creates a URL depending on given parameters. Something like this:

window.location = "{!URLFOR($Page.ProductOrderManip), null, [ProductOrderId = ProductOrder__c.Id, ProductOrderId = Project__c.Id]}";

If you want to grab any URL parameter from the page URL use a global variable CurrentPage:

  • says theres a missing '}' ? Sep 23, 2014 at 10:06

found out a way of doing this:

 function getUrlParameters(parameter, staticURL, decode){

   var currLocation = (staticURL.length)? staticURL : window.location.search,
       parArr = currLocation.split("?")[1].split("&"),
       returnBool = true;

   for(var i = 0; i < parArr.length; i++){
        parr = parArr[i].split("=");
        if(parr[0] == parameter){
            return (decode) ? decodeURIComponent(parr[1]) : parr[1];
            returnBool = true;
            returnBool = false;            

   if(!returnBool) return false;  
ProductOrderID = getUrlParameters ("ProductOrderID", false, false);
ProjectID = getUrlParameters("ProjectID", false, false);

You must log in to answer this question.

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