Use case:
- Trigger subscribes to Platform Event (hence running user = Automated Process)
- Trigger creates SObject w/ checkbox field set to
TRUE
- Process Builder executes based on SObject values, generates VF Email
Result: In the rendered VF Email, the Boolean field displays as FALSE
, even though the relatedTo value in the database is true
If the SObject is inserted manually by anyone other than the Automated Process user, the VF email renders the database field correctly as TRUE
Highly-related issue although symptoms observed are different than mine.
Here's the markup of the VF Email template:
<messaging:emailTemplate subject="Test VF template for platform events" recipientType="Contact" relatedToType="Log__c">
<messaging:htmlEmailBody >
This is a VF email template with embedded VF components. By way of reference,
these are the values from the relatedTo object:
<ul>
<li>ID:{!relatedTo.Id}</li>
<li>Source__c:{!relatedTo.Source__c}</li>
<li>Is_Success__c:{!relatedTo.Is_Success__c}</li> <!-- The boolean field -->
<li>CreatedDate:{!relatedTo.CreatedDate}</li>
<li>CreatedBy.Name:{!relatedTo.CreatedBy.Name}</li>
</ul>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Rendered email (Running User = Automated Process)
This is a VF email template with embedded VF components. By way of reference, these are the values from the relatedTo object:
ID:a2jq0000001aveTAAQ
Source__c:PEVFTest Subject
Is_Success__c:false . <<<--- WRONG value !!?!!
CreatedDate:Fri Sep 21 15:07:36 GMT 2018
CreatedBy.Name:Automated Process
Rendered email (Running User != Automated Process)
This is a VF email template with embedded VF components. By way of reference, these are the values from the relatedTo object:
ID:a2jq0000001aveYAAQ
Source__c:PEVFTest Subject
Is_Success__c:true . <<<----- correct value
CreatedDate:Fri Sep 21 15:10:29 GMT 2018
CreatedBy.Name:Fred Fubar
N.B. I'm also aware of (and can duplicate) this Automated Process user issue with VF Components with their own controller wherein you get Process builder Flow Error:
CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “xxx” process failed.
Give your Salesforce admin these details.
This error occurred when the flow tried to create records:
INSUFFICIENT_ACCESS_OR_READONLY:
user does not have access to use approval assignment email template