Here are some example usage of the apex:param tag in visualforce page :
<apex:outputText value="{0,date,dd/MM/yyyy}">
<apex:param value="{!E.Date_du_collecte__c}"/>
</apex:outputText>
//convert a decimal to integer in VF
<apex:outputText value="{0,number,integer}">
<apex:param value="{!d.key.Degustateur__r.PonderationNiveauTechnique__pc}"/>
</apex:outputText>
//replace . by ,
<apex:outputText value="{0}">
<apex:param value="{!SUBSTITUTE(TEXT(r.header.InvoiceAmount__c), '.', ',' )}"/>
</apex:outputText>
<apex:commandButton value="Process Nickname" action="{!processButtonClick}">
<apex:param name="nickName" value="{!contact.firstname}" assignTo="{!nickName}"/>
</apex:commandButton>
<apex:commandButton action="{!DisplayAcompteJournal}" rendered="{!show.showSaveLines}" rerender="head02" value="Afficher Acompte">
<apex:param name="pos" value="{!numCompteGeneralLine}" assignTo="{!linePosition}" />
</apex:commandButton>
Dynamic Apex allows users to access the metadata information about sObject and fields.
The requirement was to get the field type of a sObject.
Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.Name;
system.debug('## Field Type: '+f.getSObjectField().getDescribe().getType());
//Returns: ## Field Type: STRING
Example of other available methods that can be accessed from f.getSObjectField().getDescribe()
- getByteLength=765;
- getCalculatedFormula=null;
- getController=null;
- getDefaultValue=null;
- getDefaultValueFormula=null;
- getDigits=0;
- getInlineHelpText=null;
- getLabel=Account Name;
- getLength=255;
- getLocalName=Name;
- getName=Name;
- getPrecision=0;
- getRelationshipName=null;
- getRelationshipOrder=null;
- getScale=0;
- getSoapType=STRING;
- getSobjectField=Name;
- getType=STRING;
- isAccessible=true;
- isAutoNumber=false;
- isCalculated=false;
- isCascadeDelete=false;
- isCaseSensitive=false;
- isCreateable=true;
- isCustom=false;
- isDefaultedOnCreate=false;
- isDependentPicklist=false;
- isDeprecatedAndHidden=false;
- isDisplayLocationInDecimal=false;
- isExternalId=false;
- isFilterable=true;
- isGroupable=true;
- isHtmlFormatted=false;
- isIdLookup=false;
- isNameField=true;
- isNamePointing=false;
- isNillable=true;
- isPermissionable=false;
- isRestrictedDelete=false;
- isSortable=true;
- isUnique=false;
- isUpdateable=true;
- isWriteRequiresMasterRead=false;