Constants Used in VisualForce and Apex

Hello Guys. Today i am sharing some constants that are used in VisualForce Pages and Apex classes :

 

1. $CurrentPage : Referes to current page
2. $User : Logged in User
3. $CurrentPage.parameters : This gives the extra parameters presenet in the url (get). We can directly use any value by using its key like $CurrentPage.parameters.{!cid} where {!cid} is the parameter key.
4. $User.FirstName : Gives first name of user
5. ApexPages.currentPage(): Gives current page reference just like $CurrentPage
6. ApexPages.currentpage().getParameters() : Gives all the parameters in the url just like $CurrentPage.parameters. We can get value of a particular key by using ApexPages.currentPage().getParameters().get( {!cid} );
7. $Resource : To access static resources from salesforce
8. {!URLFor( FOLDERNAME, FILENAME)} : This will return url for a filename present in foldername
9. $ObjectType[‘{!OBJECT_NAME}’] : This will return object of type Object Name.
10.$ObjectType[‘{!OBJECT_NAME}’].Fields[{!field}] : To get particular field
11.Schema.SobjectType.Merchandise : This will give Merchandise object
12.Schema.SobjectType.Merchandise.fields : This will give all the fields of Merchandise object
13.Schema.SobjectType.Merchandise.fields.getMap() : This will return map of key value pair of Name and SobjectFields.
14.$ObjectType.Contact.FieldSets.properNames : will give a list of fields sets of contact object

Be the first to comment

Leave a Reply

Your email address will not be published.


*