Resolve email template merge field sync errors

Symptoms

You see a sync error in the sync-error-tool with the following pattern:

  • EMAIL_TEMPLATE_MERGEFIELD_ERROR — "No such column 'InformalName' on entity 'Contact'."
💡 Tip

If you see EMAIL_ADDRESS_BOUNCED or INVALID_EMAIL_ADDRESS, that is a separate issue. See resolve-email-bounce-sync-errors.

Cause

Some Salesforce orgs have customized email templates that use merge fields which do not exist on the Contact object in the Visualforce email template context. For example, {!recipient.FirstName} or {!recipient.InformalName} are not accessible in VF templates because recipient refers to the Contact object and standard fields cannot be accessed directly this way.

StoreConnect's managed package includes a custom formula field s_c__First_Name__c on the Contact object that resolves this issue. This field maps to the standard FirstName field and is designed specifically for use in Visualforce email templates. All default StoreConnect email templates already use {!recipient.s_c__First_Name__c} for contact emails.

If your org has customized email templates that still use {!recipient.FirstName} or {!recipient.InformalName}, they will fail with a merge field error during sync.

Resolution

If using default StoreConnect templates

Reset to the managed package default template. The default templates already use the correct {!recipient.First_Name__c} merge field and should not produce this error.

If using customized templates

Contact email templates

  1. Open the email template in Salesforce.
  2. Find any occurrence of {!recipient.FirstName} or {!recipient.InformalName}.
  3. Replace it with {!recipient.s_c__First_Name__c}.
  4. Save the template.

First_Name__c is a formula field already included in the StoreConnect managed package — it maps to the standard FirstName field and requires no additional setup.

Order email templates

Order email templates use the relatedTo object (the Order) rather than recipient (the Contact), so the correct merge field syntax is different.

  1. Open the email template in Salesforce.
  2. Find any occurrence of {!recipient.FirstName} or {!recipient.InformalName}.
  3. Replace it with {!relatedTo.BillToContact.FirstName}.
  4. Save the template.

Alternative (both types): Clone the affected template, make the correction in the clone, and update the StoreConnect Store record to use the new template.

Verification

  1. Confirm the sync error no longer appears in the sync-error-tool.
  2. Send a test email using the corrected template to confirm it renders correctly.
  3. Place a test order to confirm future orders sync and send emails without issues.

Prevention

  • When customising contact email templates, always use {!recipient.s_c__First_Name__c} instead of {!recipient.FirstName} or {!recipient.InformalName}.
  • When customising order email templates, always use {!relatedTo.BillToContact.FirstName} instead of {!recipient.FirstName} or {!recipient.InformalName}.
  • Audit email templates after org migrations or package updates for merge fields that may not exist in the new environment.