0

In salesforce any object attribute value(let say case recordtypeid), can be fetched using two ways,

{!$case.RecordTypeid} - with dollar sign

{!Case.RecordTypeid} - without dollar sign

Can anybody help what the difference between both and also which one to use when?

3

Generally one is a global variable and another is a merge field.

  • The global variable {!$Label.MyLabel__c } is a kind of merge field that is a built in feature of salesforce
  • A normal merge field {!Account.Name} can be defined by user (apex controller, standard controller, ...)

The ! sign followed by $ is a Global Variable.

Use global variables to reference general information about the current user and your organization on a page.

That means that you can access some information from some objects on the visualforce page or in a apex code directly without having to query a database (check out a list with all global variables here). Additionally read this useful topic for better understanding what a gloab variable is: "Understanding Global Variables"


The ! sign alone (without $) is a Merge Field.

For example if your vialforce page use a standard account controller, you can access fields from that object directly using this syntax: {!Account.Name}

Or you can define some variable in APEX controller and reference it on the viasualforce page using this syntax too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.