+ Start a Discussion
Sridhar BonagiriSridhar Bonagiri 

How to add parameters to a url

Hi,

 

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 .

 

 

ShikibuShikibu

PageReference page;

...

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

 

XactiumBenXactiumBen

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.

example:

// 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'));