function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Baird_SBaird_S 

Email workflow doesn't include value from before trigger - is there a workaround?

After users submit a record via REST, a before trigger sets one of the values (DisplayCritterList).  A workflow then triggers a confirmation email to the user, but the confirmation email doesn't include the value from DisplayCritterList.  Here is an initial write-up of the problem (https://docs.google.com/document/d/1tIm3Up-f0HnkLXiGtqcEIEbDuRhPRSd5rp5nOAPro9k/edit?usp=sharing), which I shared with Salesforce Support (no help so far).

Is there a programming workaround?

Theoretically, the value set by the before trigger should be included in the email.  In the sequence of execution (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm), the before trigger is step 3, the workflow is step 10, and sending an email is the last step.  However, it seems that the email which is sent won't access the value of DisplayCritterList until that is committed to the database (Step 19).  (In fact, even setting the workflow to a time-dependent workflow which fires one hour after the process, the email produced is still missing the DisplayCritterList value.)

Here is a debug log (https://docs.google.com/document/d/1QPVGGG0KGFAr7Rchdr7q_gH7bauaTeHEU5x0cgBe0Rg/edit) of the process, with comments on the right side, showing where these steps occur.

Am I missing something here?

How can I get the value for DisplayCritterList into the auto-reply email?

​Thanks for your help.
Best Answer chosen by Baird_S
Baird_SBaird_S
My bad ... it was a permissions issue on the DisplayCritterList field, which wasn't visible to the REST Site user.