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
John DaJohn Da 

ID Field In VF Page Load

Hi all,

I created a button of object A, and this button opens to a VF page. I added this button to the related list of object B. When I clicked on this button from the page layout of object B, it loads up the VF page and this URL:

https://domain.salesforce.com/apex/VFPageName?retURL=%2FRECORD_ID&wrapMassAction=1&scontrolCaching=1&id=RECORD_ID

(where RECORD_ID is the actual record ID, a 15 digit ID)

So I'm writing some code to get the record ID from the URL, by doing ApexPages.currentPage().getParameters().get('Id')

My question is can I rely on this "ID" parameter, that it will always show up on the URL? Or should I rely on retURL? Thanks.

Best Answer chosen by John Da
doravmondoravmon
the Id will be there all the time ~so you can get it this way ~