Skip to main content
I want to set up a VF email template based on Oppty Contact Roles which will fire when the oppty matches certain criteria.  The merge fields are from the Oppty, the Account on the oppty, and the Contact Role's Contact.  The email will be an invoice when an oppty is entered with a stage of "pledged."  I can get the email template to properly populate on a template test, but when I try to test on the actual workflow, the invoice seems to be sent but the fields are empty.

Anyone know why the merge would work in the test but not in the workflow?  (working in the production, not sandbox, since I've done this a lot with no problems in the past.)

Thank you!
2 Antworten
  1. 29. Juni 2015, 14:00
    Hi Sonam, thanks.  I was working in the production system b/c I've done a lot of this kind of work and didn't anticipate any problems.  Oh well.  What I've since learned is that the test can work perfectly even when the live version doesn't.  It's because you manually select the recipient and opportunity records.  In the live version, workflow email alerts can ONLY be sent to email addresses IN THE OBJECT that triggers the workflow.  Since we don't have email addresses in Opportunities (at the moment, we don't even have Contacts in opportunities except via Oppty Contact Roles), there's no address to send it to.  And because the template is based on Oppty Contact Roles but the workflow is based on Oppty (you can't create a workflow on Oppty Contact Roles), it basically fails completely.

    I've gotten it to work by testing with a custom email field in Opportunities for both email address and lookup to Contacts. My solution will probably be to for the users to enter a Primary Contact for at least certain Opportunities and then use a workflow field update OR some apex code to populate an email address for that Contact in Opportunities.  If I can get that to work, it will suit our needs.
0/9000