+ Start a Discussion

Question abt link


I am going to have a link in my visualforce page 'A'. It willbe called from multiple places(for ex. from 4 other pages) .


So if I have a link called back in 'A' how would I code so that it takes me to the correct place from where it was called.




We've added information to the link URL to indicate where it came from. 




For this you can make use of apex:param tag, which will give you the ability to pass some value to controller on click of commandlink.


<apex:commandLink value="http://google.com/search" action="{!method}">

<apex:param name="q" value="{!contact.name}"/>


Right, you can add a parameter to the URL. The convention is to make sure 'retURL' specifies the page you were just on. So for my custom Opportunity Product VF page, the URL to get there looks like "/apex/ProductPicker?id=xxxxxxxxxxxx&retURL=xxxxxxxxxxxxx". On my product picker page, the Cancel button takes them back to the Opportunity page, by looking for that parameter.


Let me know if this doesn't answer it.