Salesforce introduced the transform element in their winter ‘24 release. This feature simplifies data processing in flows by eliminating the need for loops and assignment elements.

With the Transform Element, you can seamlessly map source data to target data, making your flows more efficient and easier to maintain. Transform element is available for screen flows, auto-launched flows with no triggers, and record-triggered flows.

In this blog, we will walk you through the steps to use the Transform Element in salesforce flow.

Key features

  • Enables seamless mapping between source data and target data which simplifies the data transformation process.
  • Handle data collections and transform each item individually. 
  • Enables dynamic field mapping using formulas.
  • Supports aggregate calculations like sum and count.

Transform Element Component

  • Source Data: Data to transform which are available to the flow.
  • Target Data: Data after transformation. Target data could either be a single record or a collection of records. You define the target structure using an Apex class, a data type (Apex-defined or Record), or an object.
  • Formulas: Set a fixed value for the target data field or Reference up to two source collections that are nested within one another.

Business scenarios 

Case 1: Clone records, such as Accounts, Opportunities, etc

Create a Screen Flow to clone Account records selected by the user on the screen.

Step 1: Go to setup and create a Screen Flow.

Screen 1 1

Step 2: Add a Get Records element to the flow to retrieve all Account records.

Screen 1 2 1
Screen 1 2 2

Step 3: After retrieving all Account records, add a Screen element to allow the user to select the Accounts for cloning.

To display the Accounts on the screen, drag and drop a Data Table component onto the screen. And configure data sources, rows, and columns.

Set the Get Account Records collection as the source collection to populate the Data Table.

Screen 1 3 1

Set the Rows option to ‘Multiple’. 

Configure Columns by adding Name and Industry fields.

Screen 1 3 2

Step 4:  After selecting the Accounts for cloning, use the Transform element to map and prepare the Account data for cloning

 Add a resource to the source data.

Screen 1 4 1

After selecting the source data, choose selected rows to map the collection for cloning multiple records. If you want to clone only a single record, select firstSelectedRow to map the data to the target.

Screen 1 4 2

To map selected rows to the target data, add a Resource and set the data type to Record. Ensure to check the ‘Allow multiple values’ checkbox. Then, select the target object as Account.

Screen 1 4 3

After creating the target collection variable time to map the source data with the target data

Screen 1 4 4

To indicate that a record has been cloned by this flow, you can append ‘Cloned’ to the name of the record (e.g., ‘Edge Communications Cloned’). This can be achieved by using a formula in the Name field of the target data while mapping.

Screen 1 4 5

Add formula as per the business requirement

Screen 1 4 6

Step 5:  After completing the mapping between the source data and the target data, add the Create Records element.

Enable Multiple toggle to specify the creation of multiple records. Then, select the Map Accounts collection to create the cloned records.

Screen 1 5 1
Screen 1 5 2
Screen 1 6 1

Step 7: Save and activate the flow. 

Step 8: Add flow to the Home Page

  1. Go to the gear icon and select the edit page 
  2. Search for the Flow component
  3. Drag and drop the flow onto the desired section 
  4. Select the Flow 
  5. Save the page
Screen 1 8 1

Test the screen flow :

Select the records you want to clone from the displayed list.

After selecting the records click on the next button for cloning the records.

Screen 1 9 1
Screen 1 9 2

To check the selected accounts are cloned successfully.

Go to the account page and select All Accounts list view. You see the records with ‘Cloned’ appended to their name.

Screen 1 9 3

Result:  All selected accounts have been cloned.
Here is the Demo.

Case 2: Used for Aggregate Calculations

Display the total sum of the ‘Amount’ field and the count of all related Opportunities where the Stage is ‘Closed Won’ on the account record.

Prerequisite: 

Create two custom fields on the Account object.

  1. Total Closed Won Amount field to store the sum of total opportunities amount where the stage name is ‘Closed Won’. The data type will be currency.
  2. Count of Closed Won Deals field to store the total count of opportunities related to the account where the stage name is ‘Closed Won’. The data type will be a number.

Step 1: Go to the flow and select Record-Triggered Flow 

  1. Select opportunity object 
  2. Select A record is created or updated when to trigger the flow 
  3. Set the entry conditions mentioned in the image 
Screen 2 1 1

Step 2: Add a Get Records element to retrieve all related Closed Won Opportunities.

 Set the following conditions:

  1. Account ID equals the Record Account ID.
  2. StageName equals ‘Closed Won‘.
Screen 2 2 1

Step 3: Add a Transform element to map the source data with the target data 

A. Add record collection to the source data.

Screen 2 3 1

B. Configure target data 

Screen 2 3 2

C. Map source data with target data 

To calculate the total opportunities amount, Map the source collection to the Total Closed Won Amount field of the target data source.

Screen 2 3 3

To calculate the count of the closed won opportunities related to the account, Map the source data to the Count of Closed Won Deals field of the target data. 

Screen 2 3 4
Screen 2 3 5

Step 4: After mapping the data, add an Update Records element to update the Account records.

Set Total Closed Won Amount and Count of Closed Won Deals fields 

Screen 2 4 1
Screen 2 4 2

Step 5: Save and Activate the flow 

Test the record-triggered flow. 

Select an Account that has related Opportunities.s

Screen 2 6 1
Screen 2 6 2

Go to the opportunity record and change the stage to closed won.

Screen 2 6 3
Screen 2 6 4

After updating the opportunity, go to the related account and check whether the fields are populated with the correct values.

Screen 2 6 5

Result: Both the Total Closed Won Amount and Count of Closed Won Deals fields are populated with the correct value.

Now add one more opportunity with closed won and associated with the same account. 

After saving a new opportunity go back to the related account and check the fields are updated correctly.

Screen 2 6 6
Screen 2 6 7

Result: Both The total Closed Won Amount and Count of Closed Won Deals fields populated with the correct value.

Here is the Demo.

Conclusion

The Transform Element in Salesforce Flow simplifies data mapping and modification by allowing the conversion of multiple variables into a single or collection variable. It supports features like formula-based adjustments, Apex class integration, and aggregate calculations. 

While tasks like cloning accounts or data handling can be achieved using Loop and Assignment elements, the Transform element streamlines the configuration process, making it faster and more efficient.

 Stay tuned for more informative blogs! Click here!

Related Articles
Beginners Guide to Making Your LWC Component Multilingual

If you’re wondering how to make your LWC component multilingual, you’re already ahead of the curve. Global users expect content in their native language, and Salesforce gives you the tools to deliver exactly that. With Custom Labels and the Translation Workbench, you can easily localize your Lightning Web Components without touching a single line of […]

Read More
Hands-On Guide Building a Drag-and-Drop Form Builder Using Lightning Web Components

Drag-and-drop interfaces are a user experience staple, and when paired with the power of Lightning Web Components (LWC), they unlock dynamic, highly interactive Salesforce components. In this blog post, we’ll walk you through how to build a custom drag-and-drop form builder in LWC. Users can drag form fields like text inputs and dropdowns into a […]

Read More
Please Make Blog Banner How to Create an Agentforce Enabled Scratch Org in Salesforce 100 1

Setting up an Agentforce-enabled scratch org is the most important step for developers who want to experiment with AI features such as Prompt Builder and Einstein GPT. Whether you’re developing the next generation CRM software or experimenting with how generative AI may improve user experience, a scratch org equipped with Agentforce is your playground. Follow […]

Read More
Step-by-Step Guide to Enhance Your LWC Development Workflow with the Logger API

Are you looking to streamline your LWC development workflow but confused about how to do it? Then you are in the right place. The Salesforce Logger API is a powerful tool that helps you monitor, debug, and improve code quality in real time.  This step-by-step guide walks you through how to set it up and […]

Read More
Enhancing Your Salesforce Experience with a Custom Activity Component

In today’s fast-paced business landscape, productivity hinges on streamlined workflows and intuitive interfaces. While Salesforce offers robust activity tracking capabilities, sometimes the standard components fall short of specific organizational needs.  That’s where a Custom Activity Component comes in—designed to tailor your activity management experience, boost user efficiency, and provide deeper insights into customer interactions. In […]

Read More
Step-by-Step Guide to Integrating Salesforce Doc-Gen with eSigning Tools

In today’s fast-paced digital landscape, streamlining document workflows is no longer a luxury—it’s a necessity.  Integrating a document generation app, like Docs Made Easy, with an eSigning tool, helps businesses automate the entire document lifecycle—from creation to signature—saving time, reducing errors, and boosting productivity. In this guide, we’ll walk you through the key steps, tools, […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
43 Lafferty Lane, Richmond Hill, L4C 3N8, CA +1(262) 310-7818