This is the fast field update (before-save) version of the flow responsible to populate a custom Lookup field on Secure EmailMessage based on the object type encoded in Parent Record Id — but runs during the save transaction itself, with no separate DML operation and better performance.
Fast field updates can only set fields on the record that triggered the Flow, using only Assignment and Decision elements — no Update/Create/Delete Records, no subflows, and no Apex actions. If your logic needs any of those, use the after-save version instead.
Prerequisites
-
A custom Lookup field already created on Secure EmailMessage, pointing to the target object (e.g., a
Contact__clookup field to populate when the parent is a Contact) -
The three-character key prefix for that object — for example,
003for Contact,001for Account, or a custom object's own prefix (found under Setup → Object Manager → [Object])
Steps to Create the Flow
1. Create a New Flow
-
Go to Setup → Flows → New Flow
-
Select Record-Triggered Flow
-
Choose Freeform as the canvas layout
2. Configure the Trigger
-
Object: Secure EmailMessage
-
Trigger the Flow When: A record is created (or created or updated, if the Parent Record Id can change after creation)
-
Under Optimize the Flow For, select Fast Field Updates
Selecting Fast Field Updates restricts the canvas to Assignment and Decision elements only, and runs the Flow before the record is saved.
3. Add the Decision Element
-
Drag a Decision element onto the canvas
-
Create an outcome with All Conditions Are Met (AND), using:
-
Parent Record Id— Is Null —False -
Parent Record Id— Starts With — the object's three-character prefix (e.g.,003for Contact)
-
4. Add the Assignment Element
-
Drag an Assignment element onto the canvas, connected to the Decision outcome from step 3
-
Set Variable to
{!$Record.CustomLookup__c}(your actual lookup field's API name) -
Set Value to
{!$Record.cmsecureemail__Parent_Record_Id__c}
Because this is a before-save Flow, setting $Record fields directly updates the record being saved — no Update Records element or separate DML is needed.
5. Connect the Elements
Connect Start → Decision → Assignment along the "conditions met" outcome path. If Parent Record Id doesn't match (null, or a different object's prefix), the default outcome should simply end the Flow with no action.
6. Debug and Activate
-
Click Debug and run it against a Secure EmailMessage record with a known Parent Record Id to confirm the lookup populates correctly
-
Test with a non-matching ID too, to confirm the Flow correctly does nothing in that case
-
Once verified, click Activate
Mapping Multiple Object Types
If Secure EmailMessage records can be linked to more than one object, add one Decision outcome and one Assignment element per object/prefix combination, each writing to its own lookup field — all within the same Flow. Every outcome should still require Parent Record Id — Is Null — False, paired with a different Starts With prefix per outcome.
Fast Field Update vs. After-Save: Which to Use
|
|
Fast Field Update (this guide) |
After-Save (Update Records) |
|---|---|---|
|
Elements allowed |
Assignment, Decision only |
Any element, including Update/Create/Delete Records, subflows, Apex actions |
|
Can update other records |
No — triggering record only |
Yes |
|
DML / re-triggers other automation |
No separate DML — runs in the same save transaction |
Yes — separate DML, can re-fire other triggers/flows |
|
Performance |
Faster |
Slightly slower |
|
Best for |
Simple field population on the same record (like this use case) |
Anything touching related records or requiring non-Assignment logic |
An org can have multiple before-save (fast field update) Flows on the same object — Salesforce runs them in a defined order rather than restricting you to one. If you already have another before-save Flow on Secure EmailMessage, you can add this logic as a separate Flow rather than merging it into an existing one.
Support
For any questions, contact mailto:support@cloudmaveninc.com. We're happy to help.
Related Pages
-
Data Model and ER Diagrams — full reference for the Parent Record Id field and Secure EmailMessage object
-
Automation Guide — creating Secure EmailMessage records via Flow/Apex