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

How to pass Id from a command link to Controller (Action method)

I'm displaying a table of records in a visualforce page (retrieved through a list from Custom Controller).I'm having a command link (Accept) for each record and when I click this link few updations should happen to that record and it should be displayed.But how to pass the Id parameter to the action method(AcceptLead) in Controller to update that particular record.
My visual force code is as follows:
<apex:page Controller="CustomController2">
<apex:form >        
    <apex:pageblock Title="test">   
         <apex:pageBlockTable value="{!myLeads}" var="t" id="LeadInbox">
            <apex:column >
                <apex:facet name="header"><b>Action</b></apex:facet>           
                  <apex:commandLink action="{!acceptLead}" value="Accept" >                  
            <apex:column value="{!}"/>
            <apex:column value="{!}"/>
<apex:pageBlock id="test"></apex:pageBlock>
Controller Class:
public class CustomController2 {
    public List<Lead> getMyLeads() {
        String CurrentUserId = UserInfo.getUserId();
        List<Lead> myVar = [select id, name from Lead where OwnerId =: CurrentUserId AND Status != 'xxxAccepted' And isConverted = False limit 10];
        return myVar;
    public PageReference acceptLead() {
       String LeadId = ApexPages.currentPage().getParameters().get('t.Id');
Its very urgent.Any pointer would be appreciated.
Ron HessRon Hess
please see the documentation for < apex : param

this will allow you to pass an id