Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 642 Bytes

README.md

File metadata and controls

18 lines (13 loc) · 642 Bytes

apex-template-merging

Custom Apex utility for merging strings containing merge fields and replacing with values

This utility provides a way to pass a string containing merge fields using {!field_name} syntax, and getting the SObject record value.

Eg.

String myTemplate = 'Hey {!FirstName}, your email address is {!Email} and account name is {!Account.Name}';

String myResult = MergeFieldUtility.replaceMergeFieldsWithValues (
  myTemplate, // The string to merge
  '0032800000YWeRQ' // The record ID
);

system.debug(myResult);

###[DEBUG]: Hey Ben, your email address is [email protected] and account name is Edwards Enterprises