Print this page

Where do account merge fields pull from when doing a mail merge from a custom object or opportunity and selecting a Contact?

Knowledge Article Number 000003744
Description

When doing a mail merge (whether using client-side, or extended mail merge), there is a lookup field on the merge page that allows a contact to be selected. 

When trying to merge fields from Account when doing a mail merge from a custom object or opportunities, users have found a difference in behavior when using client-side mail merge, versus when using extended mail merge for a few scenarios, particularly when doing the merge from a custom object record. 

For example, take the scenario outlined below:

1.  User creates a mail merge template that has the merge fields below:

  • Custom Object Name
  • Contact Full Name
  • Account Name

2.  User does a mail merge from a custom object detail page, using client-side mail merge, and selects a Contact on the merge page using the lookup.  The Contact selected is related to an Account record.

3.  The merge document opened in Word has values for all 3 merge fields; the name of the custom object record used, the name of the Contact selected in the lookup, and the name of the Account related to the contact.

4.  The user enables extended mail merge, does the same type of mail merge, using the same mail merge template, and finds that the Account merge field(s) do not populate in the resulting mail merge document.

Resolution

There is a difference in how client-side mail merge, and extended mail merge pull their Account merge field values when doing a mail merge from a custom objects or Opportunities. 

When a user does a mail merge from a custom object (or Opportunities), he can choose to specify a contact on the mail merge generation page. This contact may be associated with an account, or associated to no account. There are 4 possible ways to populate account merge fields:

1) Contact = null; always merge from Opportunity.AccountId
2) Contact.AccountId == Opportunity.AccountId; account merge fields will be same in either case
3) Contact.AccountId != Opportunity.AccountId; account merge fields can come from either account
4) Contact.AccountId == null; account merge fields can come from Opportunity.AccountId or be blank


Examples 3 and 4 above have different results whether you use client-side or extended mail merge.

  • Client-side merge takes values from:

3) Opportunity.AccountId or (Contact.AccountId in case of custom object merge)

4) Contact.AccountId

  • Extended mail merge takes values from:

3) Contact.AccountId in case of opp merge or CustomObject.AccountId (if there is a master-detail relationship from the custom object to Account)

4) Opportunity.AccountId or CustomObject.AccountId (if there is a master-detail relationship from the custom object to Account)





promote demote