+ Start a Discussion
hacksawblade16hacksawblade16 

exaplanation of ApexPages.currentPage().getParameters().get('id');

can somebody explain me what is the significance of this statement "ApexPages.currentPage().getParameters().get('id');" what exactly happens and how it happens

kiranmutturukiranmutturu
this will be used to get the value of the parameter "id" from the current url.
Those are called query strings or parameters.
if you have an url like
https://c.cs16.visual.force.com/apex/AccountSearch?id=001f0000007AREa
if you used the ApexPages.currentPage().getParameters().get('id') then you will get the value as 001f0000007AREa as a string...
hacksawblade16hacksawblade16
thank you sir. I have a doubt here..what id would it be??.Is it a record id or the page id?? .I have a situation where i need the fetch the record id of the lead and invoke a method of a utility class from my controller and pass the record id as parameter to it and that method will return me some specific fields of the lead record object which i need to display on a vf page.
kiranmutturukiranmutturu
it depends on what you set for that basically it accepts only strings....it may any thing in the format of string...
hacksawblade16hacksawblade16
Even am stuck in similar situationi.e..I have a situation where i need the fetch the record id of the lead and invoke a method of a utility class from my controller and pass the record id as parameter to it and that method will return me some specific fields of the lead record object which i need to display on a vf page.
Plz can i get the code for this? if u dont mind