Skip to main content
I'm trying to create a email workflow in a 1-to-1 version of Salesforce NPSP in the form of a receipt for donations/opportunities. Since it's email, I need to use the Opportunity Contact Role object to access Contact Emails for the donors in the email template. But since some donors will be individuals and some organizations, I need to select appropriate merge fields for name and address in the email template. In the new Household structure this is relatively easy (relatedTo.Opportunity.Account.Name

, for instance). But it appears this doesn't work for the individual Contacts. What object do I reference in the case of individuals? Is there an object called Household (I don't see one)? Is there a single way to reference these fields, or do I have to use IF logic to choose between Account Name and Household Name? I'm basically trying to understand the structure, as I think I can come up with the visualforce code once I know the structure.

Also, when creating the email alert, I would normally choose Email Field for the Recipient Type, but when I do that in this case I get three options instead of just the email field that is typical of the Household approach. These are Billing Email, Shipping Email, and Tribute Email. None of these exist on the Contact records (Contacts have Personal, Work and Alternative as their email types, from which the user determines which is the preferred).

Thus far everything I have tried fails, but it's close. When I do a test of the email template everything works fine (merge fields for amounts and dates as well as individual and organization work fine. But when I test the workflow in production, the name and address merge fields fail for both individuals and Accounts.

In this case, I wonder if using the Opportunity Contact Role for the email template is somehow a mistake. The Contact Role is specific to the Opportunity, so I thought it would work just fine. The logic was, when a certain kind of opportunity comes in, trigger the email, which is built on the opp Contact role, then plug in the merge fields and send the mail. But that doesn't work.

I'm very interested in any ideas anyone has.

@Salesforce.org System Administrators@Nonprofit Success Pack
11 risposte
0/9000