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
How to Integrate Salesforce Data Cloud with Amazon Redshift

Companies can finally connect Amazon Redshift to Salesforce Data Cloud without using the ordinary username & password authentication systems ever since its collaboration with AWS has happened. Business owners no longer have to be concerned about managing static credentials or breaching data security. By leveraging Salesforce IDP, companies can easily access their data lakehouse in […]

Read More
Trigger Prompt Templates Using Flow, Apex, or REST API

A prompt template is a pre-designed structure in Salesforce, specially designed to create personalized prompts by filling the substitute with particular details of customers, products, and more. This approach strengthens the creation of prompts and lets teams generate data-driven content. Every time a prompt template is used, it automatically merges the data to create a […]

Read More
Step-by-Step Guide on Adding Opportunity Team Members to Slack Channel

Salesforce allows you to improve communication by effortlessly connecting Opportunity Team Members to Slack channels. This step-by-step blog will show you how to enable Opportunity Teams, configure Slack integrations, and automate the process with Salesforce Flow. Real-time Slack notifications may help you streamline communication, increase productivity, and keep your sales team on the same page. […]

Read More
How to Use TypeScript in Salesforce Lightning Web Components (LWC)

TypeScript is a programming language developed by Microsoft; used for enhancing JavaScript by adding different static types. With the help of TypeScript, developers can easily find errors during the development process before the execution. It also makes the code more readable and maintainable. With the successful integration of Salesforce Lightning Web Components (LWC), TypeScript improves […]

Read More
Expert Guide on Seamless Integration of Salesforce and QuickBooks Online

Integrating Salesforce with QuickBooks Online can significantly streamline your business operations, improving data accuracy and efficiency. QB Sync Made Easy offers a seamless solution to synchronize customer and financial data between the two platforms. This expert QuickBooks Online, on the other hand, is a leading accounting tool specifically developed for small and medium-sized businesses that […]

Read More
A Complete Guide to Salesforce CPQ Contract Amendment and Renewal

Salesforce CPQ software offers robust features for managing pricing, product configurations, and quotations. The capacity to effectively modify and renew contracts is essential for businesses managing intricate agreements and long-term partnerships. In this guide, we’ll walk you through the details of contract amendment and renewal processes in Salesforce CPQ. About Salesforce CPQ Contract Amendments Modifications […]

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