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
Sridhar BonagiriSridhar Bonagiri 

How to add parameters to a url



I have  couple tabs which displays the related lists of the corresponding objects which are related to the first tab object.


when I selected a record in the related of any tab for edit , it takes me to native edit functionality , once edit is done there , i wanted to come back to the same tab from which I selected the record.


is there any way to add parameters to url .




PageReference page;


page.getParameters().put(key, value);



You should be able to add parameters to the retURL parameter (maybe saveURL too?) so that when you go to native functionality and click on Save or Cancel it will redirect back to your visualforce page, together with any added parameters.


// go to a record's edit page PageReference ref = new PageReference('/' + myrecordid + '/e'); // Add ret url parameter to redirect back to my custom vf page with an added "tabname" parameter to the retURL page. ref.getParameters().put('retURL', EncodingUtil.urlEncode(Page.myvfpage.getUrl() + '?tabname=3', 'UTF-8'));