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
SalesforceAddictSalesforceAddict 

anyone can tell me when we use apex param

Best Answer chosen by SalesforceAddict
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_param.htm

A parameter for the parent component. The <apex:param> component can only be a child of the following components:
<apex:actionFunction>
<apex:actionSupport>
<apex:commandLink>
<apex:outputLink>
<apex:outputText>
<flow:interview>
 
<!-- For this example to render fully, associate the page
with a valid contact record in the URL.
For example: https://Salesforce_instance/apex/myPage?id=001D000000IRt53 -->

<apex:page standardController="Contact">
    <apex:outputLink value="http://google.com/search">
        Search Google
        <apex:param name="q" value="{!contact.name}"/>
    </apex:outputLink>
</apex:page>


2)  https://success.salesforce.com/answers?id=90630000000hfRmAAI

Basically the apex:param tag is used to pass values from the Visualforce Page to the Apex Controller. A simple use case could be this:

Use Case:
Display all the Leads in the Database in a tabulated form. There should be 2 Columns in which the first column would display the Lead Name and the last column will have a Delete button. When the User clicks the Delete button, the corresponding Lead will be Deleted from the Database.
Apex class
public class ApexParamDemoController{
    //Property to hold the Id of the Record to be Deleted
    public Id RecordToDelete {get; set;}
    
    //Query all the Leads from the Database
    public List<Lead> AllLeads{
        get{ return [SELECT Id, Name FROM Lead]; }
    }
    
    //Delete the Record from the Database
    public void deleteRecord(){
        DELETE new Lead(Id = RecordToDelete);
    }
}

Your Visualforce Markup:
 
<apex:page controller="ApexParamDemoController">
  <apex:form id="form">
    <apex:pageBlock>
      <apex:pageBlockTable value="{!AllLeads}" var="Lead">
        <apex:column value="{!Lead.Name}"/>
        <apex:column>
          <apex:commandButton value="Delete" action="{!deleteRecord}" reRender="form">
            <apex:param 
              name="leadToDelete" 
              value="{!Lead.Id}" 
              assignTo="{!RecordToDelete}"/>
          </apex:commandButton>
        </apex:column>
      </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>

It has an apex:commandButton that invokes the apex method - deleteRecord via the action attribute. Now, you should also notice that this very command button wraps an apex:param tag too. 

This apex:param tag is responsible for passing the ID of the that Lead record. The apex:param passes the value contained in {!Lead.Id} and assigns it to the property back in the Apex Class - RecordToDelete. So when the Delete button is clicked first the value will be assigned to the RecordToDelete via the apex:param tag and then the method - deleteRecord will be executed.

Let us know if this will help u