Secure File Transport

Custom Lookup Population on Secure P2 Container

This is the fast field update (before-save) version of the flow responsible to populate a custom Lookup field on Secure P2 Container 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__c lookup field to populate when the parent is a Contact)

  • The three-character key prefix for that object — for example, 003 for Contact, 001 for Account, or a custom object's own prefix (found under Setup → Object Manager → [Object])

Steps to Create the Flow

1. Create a New Flow

  1. Go to Setup → Flows → New Flow

  2. Select Record-Triggered Flow

  3. Choose Freeform as the canvas layout

2. Configure the Trigger

  1. Object: Secure P2 Container

  2. Trigger the Flow When: A record is created (or created or updated, if the Parent Record Id can change after creation)

  3. 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

  1. Drag a Decision element onto the canvas

  2. Create an outcome with All Conditions Are Met (AND), using:

    1. Parent Record IdIs NullFalse

    2. Parent Record IdStarts With — the object's three-character prefix (e.g., 003 for Contact)

4. Add the Assignment Element

  1. Drag an Assignment element onto the canvas, connected to the Decision outcome from step 3

  2. Set Variable to {!$Record.CustomLookup__c} (your actual lookup field's API name)

  3. Set Value to {!$Record.cm_datatransfer__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

  1. Click Debug and run it against a Secure P2 Container record with a known Parent Record Id to confirm the lookup populates correctly

  2. Test with a non-matching ID too, to confirm the Flow correctly does nothing in that case

  3. Once verified, click Activate

Mapping Multiple Object Types

If Secure P2 Container 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)

 

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 P2 Container, 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.