1

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 "";
  else
    return results[1];
}

ProductOrderID=a1kg0000000TFiTAAW&ProjectID=a0Db00000051nRrEAI
1

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:

{!$CurrentPage.parameters.someURLparameter}
| improve this answer | |
  • says theres a missing '}' ? – ClevelandDan Sep 23 '14 at 10:06
0

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;
        }else{
            returnBool = false;            
        }
   }

   if(!returnBool) return false;  
}
ProductOrderID = getUrlParameters ("ProductOrderID", false, false);
ProjectID = getUrlParameters("ProjectID", false, false);
window.location.assign('/apex/ProductOrderManip?ProductOrderID='+ProductOrderID+'&ProjectID='+ProjectID+'');
| improve this answer | |

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.