0

I'm creating report creator and I need to change {!mergeField} in string to it's actual value, same as it works in email templates. For example 'Hello Mr.{!$User.LastName}' -> 'Hello Mr.Anderson'. How can I achieve it?

Updated

Long story short - I want to mimic work of email templates and for this I need to replace "{!property}" with it's value.
User enters some predefined tags and pass parameters to template that after can be used with certain record to generate pdf.

2
  • you are trying to mimic SFDC mergeField replacement in a custom solution? This is non trivial, especially since merge fields can cross object boundaries and include formulas
    – cropredy
    Commented Mar 2, 2015 at 17:37
  • @crop1645 ye, it isn't, but I came up with solution, that enough to me. I'm using Regex to find merge fields and then, based on data from Schema and some global components like $User replace requested fields with a value using dynamic SOQL
    – ytiq
    Commented Mar 4, 2015 at 2:58

1 Answer 1

1

I haven't came up with complete idea, but it suits my needs. I'm using Regex to find merge fields and then, based on data from Schema and some global components like $User replace requested fields with a value using dynamic SOQL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .