Visual Force Email Templates being sent as blank by Automated Process User

This might happen if an automated process user updates a record and then uses the same record to send an email using the Visual Force email template.

Example of email template:

Hi,
XYZ has submitted {!relatedTo.Name} for your re-approval.

The following title of a known issues article in Salesforce is:
VF Workflow Emails are Blank when the records are Last Modified by "Automated Process" user

Solution:

To replace/override the automated process user by any user who has required permissions.

step 1: Login to workbench

step 2: Use below POST endpoint

/services/data/v58.0/tooling/sobjects/PlatformEventSubscriberConfig

step 3: JSON body should appear below:

{
    "BatchSize" : "50",
    "DeveloperName" : "",
    "MasterLabel" : "",
    "PlatformEventConsumerId" : "01qXXXXXX..", // APEX Trigger's ID
    "UserId" : "005XXXX..." // User's ID
}

step 4: Hit Execute, that will override automated process user with user you wanted and now your email will be filled with data.

To ensure that PlatformEventSubscriberConfig record is created use following SOQL query:

SELECT DeveloperName, MasterLabel, PlatformEventConsumerId, UserId, BatchSize FROM PlatformEventSubscriberConfig

check "use tooling api" option in developer console to use above query. 

Comments

Popular posts from this blog

How to Add a Dynamic Child List to Parent in Apex Class || Trigger using map

A - Z Guide to Using the Wire Decorator in LWC Salesforce

(Salesforce Apex 2024 Release) getSalesforceBaseUrl method is deprecated