+ Start a Discussion

How to get the record or recordId from vf page to Apex class or extension?

Hi All,


    I have displayed list of records in vf page.For each record i have a custom button.

      Now Whenever i click that button, i want to get that particular record into apex class.


Can anyone tell me how we can get the particular record from vf page to apex class.



Thanks in Advance...


Hi Mandadi,


Try to use <apex:parm> tag of visualforce to pass the record or recordId from vf page to Apex class or extension.

see below example for that.


Visualforce Page:

<apex:page controller="param" >
        <apex:commandButton value="Proceed to Upload" action="{!proceedioUpload}" id="uploadButton">       
           <apex:param value="org" name="uploadType" assignTo="{!uploadType}" id="param"/>


Apex Class:

public class param{
    public String uploadType {get; set;} 
    public pageReference proceedioUpload(){ 
        return null; 




Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:- http://mrjavascript.blogspot.in/