How to use template merge field on table header?

  • 2
  • Question
  • Updated 6 years ago
  • Answered
Is it possible to use a merge field for Custom Label on a table header. For example when listing line items from one opportunity it would be be nice to be able to include the currency with a template on the header of a table. I tried to use template merge fields for table fields without success. I guess this is because that would need to merge for every row in the table. But I would like to get the currency from the parent opportunity and merge with. Is this possible?
Photo of Peter Baeza

Peter Baeza

  • 2,868 Points 2k badge 2x thumb

Posted 6 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 52,276 Points 50k badge 2x thumb
Official Response
There are two best approaches to this, depending on whether or not your org is multi-currency or single-currency:

(a) Single-currency orgs: just add the currency manually to the column header, e.g.:

Custom Label: "Sales Price ($)"

(b) Multi-currency orgs: currently you should be able to display the parent Opportunity record's Currency Code (e.g. 'USD', 'GBP', 'EUR'), but not symbol, through template syntax:

1. Assuming that your parent Opportunity record is in a model called 'OpportunityData'), make sure that you add the "CurrencyIsoCode" field to the Model.
2. Use this for your Sales Price field's Custom Label:

Sales Price ({{#$}}{{CurrencyIsoCode}}{{/$}})

(This will retrieve the first row in the OpportunityData model, and get the value of its CurrencyIsoCode field).

If you'd like to dynamically show the symbol, instead of the code (e.g. $), you could create a Formula Field on the Opportunity object that determines the currency symbol based on the CurrencyIsoCode field, e.g.