Learn how to use the Flow Transform element to map Opportunity record IDs into a text collection without looping — faster, cleaner, and easier to maintain.
Big idea
The Transform element in Salesforce Flow lets you map data from one collection or object to another without iterating with a Loop. This example uses an After-Save record-triggered flow on Account to find open Opportunities and collect their Ids into a text collection variable.
When to use Transform
Use Transform when you need to map or transform values from an existing record collection to a target collection (for example, collecting Ids or extracting a specific field) and you don’t need complex filtering or ordering. If you need advanced filtering or sorting, use Get Records with Collection Filter or a Loop instead.
Flow overview (use case)
Business requirement: When an Account is created or updated, find all related open Opportunities and store their IDs in a text collection variable for downstream processing.
High-level steps
- Start: Record-Triggered After-Save Flow on Account (created or updated)
- Get Records: Query Opportunity where AccountId = {!$Record.Id} and IsClosed = false; store all records
- Transform: Map Opportunity.Id from the source collection to a Text collection variable (target)
- Save/Use: Use the text collection variable for further actions (Apex, Invocable, or other Flow elements)
Step-by-step: Build the flow
Follow these step-by-step instructions in Flow Builder:
- Create a new Flow: Start from Scratch → Record-Triggered Flow → Object: Account, Trigger: created or updated, Optimize for: Action and Related Records.
- Add Get Records: Object = Opportunity. Filter: AccountId equals {!$Record.Id} AND IsClosed equals {!$GlobalConstant.False}. Store All Records and Automatically store all fields.
- Add Transform element: Set Source Data to {!Get_Open_Opportunities}. For Target Data pick Data Type = Text and check “Allow multiple values (collection)”, then create the target variable. Map Source.Id → Target collection.
- Save, set API Version (e.g., 63), add an Interview Label, and Activate the Flow.
Notes, limitations and best practices
- Transform does not filter or sort. Always filter in Get Records or use a Loop for complex logic.
- Use Transform to keep flows simple and performant where mapping alone is required.
- For very complex data structures consider integrating Apex with Transform.
Proof of concept & debugging
Use On-Screen Debug in Flow Builder (or Debug with Run) to verify the Transform output returns the expected list of Opportunity Ids.
Why this matters
Reducing unnecessary loops keeps flows easier to read and maintain, and can reduce the chance of errors. For Salesforce admins and developers, mastering Transform saves time and leads to cleaner, more performant automation.
Category: Salesforce Flow








Leave a Reply