Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Transform Data in a Flow

          Transform Data in a Flow

          Automate how you transform data between Salesforce and an external system using the Transform element. You can create mappings between the source and target data, or set fixed values for the target data.

          Required Editions

          View supported editions.
          User Permissions Needed
          To open, edit, create, activate or deactivate a flow using all flow types, elements, and features available in Flow Builder, including Einstein and Agentforce for Flow: Manage Flow

          Watch this demo (English only) of transforming data in Flow Builder.

          For another viewing option, see Transform Your Data with Flow Builder (English Only).

          Before you begin, understand the structure of your source and target data, such as whether the data contains multiple levels of collections within other collections. Mapping fields in a collection requires rules to preserve data integrity. See Transform Element.

          1. Add the Transform element to your flow.
            1. Enter the label, API name, and description.
            2. For Source Data, click the Add Resource button Add Resource button and select the flow resource to transform the data.
            3. For Target Data, click the Add Resource button Add Resource button and select the data type.
            4. If the target data is a collection, select Allow multiple values (collection).
            5. If the data type is a record or Apex-defined, select the Apex class or object for the target data that the Transform element generates.
              For example, if you specified that the target data is a collection and that the record data type is the Account object, the Transform element generates an account collection. If you didn’t specify a collection, the target data is a single account.
          2. Map the source and target data.
            1. Hover over a source data field and click the Map button Circled bullet.
            2. Next to a target data field, click the Map button Circled bullet.
              If a target field doesn’t have the Map button Map icon, you can’t map to it.
            3. To view a mapping tip next to a target field or collection that’s unavailable for mapping, hover over the target field or collection, and then hover over the error icon.
              Mapping tip of an unavaiable target field in Transform element
            4. To view a mapping tip of a misconfiguration error, hover over the error icon Error icon shown next to a target data field or collection.
              Mapping tip of misconfiguration error in Transform element
            The Transform element adds a dashed line to indicate mappings within a collapsed object or collection. The Transform element adds dotted lines to identify the collections that contain the mapped fields so that you can easily view the collections in both resource data structures. When mapping fields in a collection, the source and target fields must be at the same hierarchical level in their respective resources. See Flow Element: Transform.
          3. To transform data with a formula, click the mapped field name, and then click Formula button then Formula.
          4. To delete a mapping, click the field name, and then click the Delete button Delete button.

            After you finish transforming data, you can save the target data to Salesforce or to an external system.

            To save the target data to Salesforce, add the Update Records element, and then configure it to reference the resource with the same name as the Transform element. For example, if the API name of the Transform element is Return_Order, select Return_Order for Record or Record Collection in the Update Records element.

            To save the target data to an external system, create an HTTP callout action that uses a method like POST.

          Example
          Example A sales agent runs a screen flow to return two orders for store credit. The agent’s customer has an account in Salesforce. The customer’s order data is stored in a system outside Salesforce. To update the Order record in Salesforce, the flow gets the latest order data from the external system and transforms the data, so the flow can save the changes in Salesforce.

          In the Transform element, the amount, customerId, and status source data fields are mapped to the target data fields.

          Mappings between source and target data fields

          The mapping between the source data’s amount field and the target data’s Amount__c field uses a formula to transform the data.

          Mappings between source and target data with the Formula button highlighted

          The formula subtracts a fixed amount from the source data’s amount field for a restocking fee. The result of the formula is the transformed value for the target data’s Amount__c field. The formula shows the merge field syntax, where [$EachItem] represents each item in a collection. In this example, the merge field references a collection of 2XX, and each 2XX item has an amount field. For each amount field, the formula subtracts 5.

          Formula builder that show example formula expression

          Next in the flow, the Update Records element saves the changes to the database. And finally, the Action element makes an HTTP callout to update the order status in the external system.

           
          Loading
          Salesforce Help | Article