Last Updated on February 5, 2025 by Rakesh Gupta
Big Idea or Enduring Question:
-
How can I use the Transform element to map and transform data from one collection variable to another without using a loop?
Objectives:
After reading this blog, you’ll be able to:
- Utilize the Transform element to map and transform source data to target data
- Apply filters to remove data from the Transform element
- And much more!
Business Use case
Warren Mason, a Junior Developer at Gurukul on Cloud (GoC), has recently been hearing about the Transform component in flows from his colleagues. He has a few questions, such as: What is the Transform element in a flow, and can you provide a simple use case for it that is easy to understand?
With that in mind, he reached out to his mentor, Joe Smith. Joe provided a straightforward use case to help anyone to understand the purpose of the Transform element. Here is Joe’s use case:
When an account is updated, find all related open opportunities and store their IDs in a text collection variable.
Automation Champion Approach (I-do):
Before diving into the discussion of the Transform element, let’s take a moment to pause and understand how you can solve the aforementioned business use case. Typically, most of us would use the Loop element, as shown below.
The Loop element is the traditional method for iterating over items within a collection variable by temporarily assigning each current record to a loop variable.
Using the Loop Element: A Traditional Approach
In the context of our use case—when an account is updated, finding all related open opportunities and storing their IDs in a text collection variable—the Loop element would function as follows:
- Retrieve Collection: First, we will retrieve the collection of open opportunities related to the updated account.
- Iterate Through Collection: Using the Loop element, you would iterate through each opportunity in the collection.
- Store IDs: You would then add each opportunity ID to a text collection variable for further processing or reference.
Introducing the Transform Element: A Modern Approach
This is where the Transform element comes into play. The Transform element offers a more streamlined and efficient approach to handling data transformations within the flow. Instead of iterating through each record, the Transform element allows you to map and transform data from a source format to a target format with ease.
Key Features
The Transform element is a powerful tool designed to simplify and enhance data manipulation within the flows. Here are its key features:
- Data Mapping: Enables users to seamlessly map fields from the source data to the target data, simplifying the overall data transformation process.
- Data Transformation: Supports the use of formulas to modify data values, allowing for sophisticated and complex data manipulations.
- Collection Handling: Capable of processing collections of data, facilitating granular-level transformations for more precise data management.
- Apex Class Integration: Integrates with Apex classes to handle intricate data structures and complex logic, providing enhanced flexibility and functionality.
One important thing to remember when using the Transform element is that it doesn’t have the ability to filter records. If you need to filter records, do so using the Get Records element with a Collection Filter. If your filtering requirements are too complex to be handled by the Get Records element and Collection Filter, consider using a loop instead of the Transform element.
The same applies to sorting data, as the Transform element doesn’t include a data sorting feature.
Guided Practice (We-do):
There are 3 steps to solve Warren’s business requirement using Record-triggered After-Save Flow. We must:
- Define flow properties for a record-triggered flow.
- Add a Get Records element to find related open opportunities.
- Add a Transform element to collect opportunity IDs into a text collection variable.
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Start From Scratch option and click on Next.

- Select the Record-Triggered Flow option, click on Create
- Object:Â Account
- Trigger the Flow When:Â A record is created or updated
- Optimize the Flow For:Â Action and Related RecordsÂ
- Click the X at the top to save your changes.

Step 2: Adding a Get Record Element to Find Related Open Opportunities Â
The next step is using the Get Element to find related open opportunities. We will apply the filter logic to find the related open opportunities here instead of using an additional element.
- On Flow Designer, click on the +icon and select the Get Records element.
- Enter a name in the Label field; the API Name will auto-populate.
- Select the Opportunity object from the dropdown list.
- Select All Conditions Are Met (AND).Â
- Set Filter Conditions
- Row 1:
- Field: AccountId
- Operator: Equals
- Value: {!$Record.Id}
- Click Add Condition
- Row 2:
- Field: IsClosed
- Operator: Equals
- Value: {!$GlobalConstant.False}
- Row 1:
- How Many Records to Store:
- Select All record
- How to Store Record Data:
- Choose the option to Automatically store all fields.Â
- Click the X at the top to save your changes.

Step 3: Add a Transform Element to Collect the Opportunity IDs into the Text Collection Variable
Now we will add a Transform element to collect the opportunity IDs from the record collection variable into the text collection variable.
- On Flow Designer, click on the +icon and select the Transform element.
- Enter a name in the Label field; the API Name will auto-populate.
- For Source Data select {!Get_Open_Opportunities}.

- For Target Data select the following options:
- In the end, connect Id from Source to Target Collection variable.

- Click the X at the top to save your changes.
In the end, Warren’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter the Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 63
- Interview Label: UseCase for Transform {!$Flow.CurrentDateTime}
- Click Save.

Almost there! Once everything looks good, click the Activate button.
Proof of Concept
I am using On-Screen Debug in Flow to check if the logic is working and to return the opportunity IDs.
Formative Assessment:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.




Thank you for a great explanation on simple Transform use case. I look forward to additional slightly more complex use case examples.
Thank you, sir! Happy new Year!!!