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

what is the usage of apexpages.currentpage.getparameter().get('id')

Could you please explain about the usage of apexpages.currentpage.getparameter().get('id'). with an example.


1- in which situations we need to use this..










Ankit AroraAnkit Arora

This is to get the parameter value passed in URL, like my URL is this:'a01E000000ByPso'


Now using "apexpages.currentpage.getparameter().get('id')" in apex I can get the value "a01E000000ByPso"


For more reference please visit:



Ankit Arora

Blog | Facebook | Blog Page


As a small addendum, it should be noted that "ApexPages.CurrentPage.getParameter().get('Id')" is rarely needed when the page is an "extension", as this parameter is automatically passed to your extension via the ApexPages.StandardController parameter of the constructor:


private Id recordId;

public MyExtension(ApexPages.StandardController controller) {
  recordId = controller.getId();

I've noticed a trend amongst novice developers to ignore the ApexPages.StandardController parameter, probably because they do not understand its intended use, which leads to code bloat and less maintainable code (e.g. if your logic changes and you need to load a different record ID, it can become non-trivial to determine where this ID value is used).