1

Is it possible to store a merge field like {!Account.Name} as a custom setting, then reference the custom setting on a VisualForce page that uses the standard controller?

0

yes you can do that but not in the way in which you are doing. I suggest you to use field API name and then refer that. In this way will you get expected output

{!reference[expression]} 

Here reference is object and expression is your field.

Reference

Or you can store both object name and field name and then with some custom code use them in VF page

{!$ObjectType[objectType].fields[f].Label}

Where ObjectType is object and f stands for field.

Reference

  • I am not trying to get the field name, I am trying to get the value of the field. I essentially want to store the merge field as a custom setting, this could be change so when displayed on the VF page it could change to be any field. – developer__c Jun 6 '16 at 12:46
  • @developer__c label is just for reference. You can take any approach to display the value. Check the reference links for more details. – Tushar Sharma Jun 6 '16 at 12:48
  • Just displays {!Account['Name']} on the page. This is being displayed as the literal string, rather than merging the actual value. – developer__c Jun 6 '16 at 12:53
  • @developer__c if you use this on VF page then you will get Name of this account or if this name is stored in some string then this will also work {!Account[varName]} – Tushar Sharma Jun 6 '16 at 12:55

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.