+ Start a Discussion
mohit Srivastavamohit Srivastava 

how to get record id from detailed page

i want to get id of account record on a click of custom button and  i need that id in the cunstructor of redirecting page.. so that i can show all the record related to that id on vf page.

Balaji BondarBalaji Bondar
Hi Mohit,
You can access URL parameter using this code.
Id accountId = ApexPages.currentPage().getParameters().get('id');

You can use below code access account object in the extension controller of your visual force page on  button click action
public myControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.