+ Start a Discussion
Nikhil Shrigod 25Nikhil Shrigod 25 

how to get previous page url from current visualforce page

Hi All,

I want to get previous page URL from the current visualforce page or from the controller class of the current VF page so that I can extract the id from the URL.

I am display this VF page from a list button created on 'Opportunity products' object in Lightning. 
Himanshu.SFDCHimanshu.SFDC
Hi Nikhil,

When you are redirecting from list button you can pass ID of record or url to vf page in retUrl or in any other parameter. Which you can get directly in Controller.

User-added image
Nikhil Shrigod 25Nikhil Shrigod 25
Hello Himanshu,

Thanks for replying, but it is not working.
I tried passing the opportunity id similarly you did it in the above screenshot, but when we try to access the 'retUrl' parameter from apex it returns 'null'.
Himanshu.SFDCHimanshu.SFDC
Hi Nikhil,

Can you provide here your Button script and Apex code ?