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.

  • 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 Mar 2 '15 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 Mar 4 '15 at 2:58
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

| improve this answer | |

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.