Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

I don't know if I will find an answer to this, but I am having a mysterious problem with visualforce emails not populating with data when being sent via a workflow, but they do send fine when sent via the Send Test and Verify Merge Fields button.

Other Reports

  1. http://salesforce.stackexchange.com/questions/22568/approval-process-step-field-update-doesnt-appear-in-same-steps-visualforce-ema (It's not an approval).  
  2. https://developer.salesforce.com/forums/ForumsMain?id=906F00000008lpRIAQ (no answer, and their data model is simpler, so I think it is not to do with the data model)
  3. https://success.salesforce.com/issues_view?id=a1p30000000SdBfAAK (It's not the same because this is saying the workaround is to use relatedTo, which I am). 
  4. https://success.salesforce.com/answers?id=90630000000h2ywAAA (does not actually answer the question).

Data Model

 

Notes

  • This email HAS WORKED! I can NOT reproduce the situation where it did work, but it definitely has! 
  • VF Email is being sent from Custom Object B and contains fields from all related objects. 
  • Emails sent from Custom Object A work with no problem. 
  • Values from Custom Object C show fine. 
  • The VF Email Template header is 
    • <messaging:emailTemplate subject="My Email Subject" recipientType="Contact" relatedToType="ObjectB__c" rendered="true">

Steps

Steps to try to work out what the problem is and fix it

StepNotesResult
Create formula fields for data

rather than

{!relatedTo.ObjectA__r.Campaign__r.Account__r.Notes__c}

I added the Notes field to Object B as a formula field so it was

{!relatedTo.Notes__c}

I did this for 3 fields

(error) No fields displayed
Send email immediatelyThe workflow was running after an hour(error) No fields displayed
Simplified the HTML Email (error) No fields displayed
Added the IDs for all the objects into the email body (tick) ALL IDs Displayed!!
Added the Names

If the Standard Fields of IDs display, do the standard fields of Names display?

Because the field that is displaying from ObjectC is the Name field.

(tick) All Name fields displayed!!
Added the new fields without any HTML embellishmentJust replaced the name fields that did display with the fields I wanted to display.(error) No Custom fields displayed!
Wrapped the fields in the output tags

To try to see if there was anything to the non-answer in article 4. above.

I also added Created Dates (standard fields) in output tags.

(error) No Custom fields displayed.

(tick) Standard fields displayed

Changed to plaintextemailbody (error) Nope, so it's not about HTML
Changed the Contact lookup to be directly from Custom Object B

So instead of

{!relatedTo.ObjectA__r.Contact.Notes__c}

I had

{!relatedTo.Contact__r.Notes__c}

(error) Nope, so it's not about how far away the object is at all.
Send via process builder

Hey, it's worth a shot!

But of course, since it just uses the standard email alert, it won't do anything different.

(error) Nope, no difference.
Sent the email from another objectI used a workflow to update ObjectA then send the email from there - it did not work even though there are other emails sending from that object quite fine.(error)! AAAGHHH!
Dialed back the API version

So, what was the difference between the email that was working and the one that was not?

The API Version. The working email was on 32, the non working was on 33

(error) Nope!

 

So, at this stage we know, it's not about the data model and it's not about HTML visualforce. It's not about the HTML structure and it's not about whether the fields are enclosed in output tags or not. It is only about whether the fields are custom fields or not. 

I could test with another object but I need to send from this object. 

I could test without visualforce emails but I need to use visualforce emails to have conditional text in this email. 

 

 

 

 

  • No labels