+ Start a Discussion
sreejasreeja 

what is the use of ApexPages.currentPage().getParameters().get('recordId'),

can anybody explain with a example where this scenario is used  in a simple manner,  i have gone through differnt examples , bt iam unable to understand it >>ApexPages.currentPage().getParameters().get('recordId') 
Best Answer chosen by sreeja
Prema -Prema -
Hello Priya,

Suppose you want to get the ID of the current record detail page and you want to show it on your VF page once you click on the button then you can use ApexPages.currentPage().getParamaters().get('id'); It will get the id of that objects record. You can also get the name instead of id like 
public Opportunity currentRecord{get; set;}
currentRecord=ApexPages.currentPage().getParamaters().get('name') and if you want to see the value on developer console you can use System.debug(currentRecord);
Please let me know if it helps

All Answers

Prema -Prema -
Hello Priya,

Suppose you want to get the ID of the current record detail page and you want to show it on your VF page once you click on the button then you can use ApexPages.currentPage().getParamaters().get('id'); It will get the id of that objects record. You can also get the name instead of id like 
public Opportunity currentRecord{get; set;}
currentRecord=ApexPages.currentPage().getParamaters().get('name') and if you want to see the value on developer console you can use System.debug(currentRecord);
Please let me know if it helps
This was selected as the best answer
@@@we@@@@@@we@@@

ApexPages.currentPage().getParameters().get('recordId'),
use to get record  id your current  page  
http://www.sfdcpoint.com/salesforce/get-current-record-id-salesforce/
https://www.cloudforce4u.com/2013/07/get-current-record-id-salesforce.html
sreejasreeja
thank you prema and @@we@@
szad khnszad khn
internet ki jnakari (https://indiakabest.in) india ka best internet ki jankari hindi me

paytm mobile recgarge (https://indiakabest.in/paytm-mobile-recharge-kaise-kare/)
Aman Singh 213Aman Singh 213
TechTutr.com (https://techtutr.com (https://techtutr.com/))
Which of the following correctly describes NIMS (https://techtutr.com/which-of-the-following-correctly-describes-nims/)