Transform Data From One Form to Another
Learning Objectives
After completing this unit, you’ll be able to:
- Convert data table selections to a text collection with the Transform element.
- Update records that match the contents of a text collection with the In operator.
Transform a Collection into a Different Type of Collection
Let’s build the other version of the previous unit’s flow. In this version, you use the Transform element to create a text collection, rather than a record collection. Instead of storing a series of records, a text collection stores a series of text strings. When you map the source data’s Id field to the text collection, the new collection stores all of the selected records’ IDs as text strings instead of records.
But why is a text collection of record IDs useful? The Update Records element has a specific operator—the In operator—in its filter options. The In operator looks through collections that contain simple values, such as text or numbers, and finds all the records that have a value in the collection. The In operator can’t look through record collections, so you configure the Transform element to turn the record collection into a text collection.
First, return to the All Flows list view and open the Choose Steps to Update flow. This flow should have only two elements: Get Steps, and Select Steps to Update.
Map the ID from Source to Target
Next, use a Transform element to create a text collection of the records’ IDs.
- After the Select Steps to Update element, add a Transform element.
- For Label, enter
Transform Step IDs
.
The API Name should auto-populate asTransform_Step_IDs
.
- In the Source Data box, click
.
- For Resource, select the Select_Steps screen component.
- In the Select_Steps box, click the > in the selectedRows line to display the collection’s available fields.
- For Resource, select the Select_Steps screen component.
- In the Target Data box, click
.
- For Data Type, select Text.
- Select Allow multiple values (collection).
- Click Create.
- For Data Type, select Text.
- In the Source Data column, mouse over the Id field and click
in the Id line.
- In the Target Data column, click
in the Id line.
- Save the flow.
Update the Onboarding Project Step Records from Their IDs
Last, you add an Update Records element with a filter that finds all the Onboarding Project Step records whose Id is in the transform’s text collection. Then configure the Update Records element to update the Onboarding Project Steps’ statuses to the value that the user selected on the screen.
- After the Transform Step IDs element, add an Update Records element.
- For Label, enter
Update Steps
.
The API Name should auto-populate asUpdate_Steps
.
- For How to Find Records to Update and Set Their Values, select Specify conditions to identify records, and set fields individually.
- For Object, select Onboarding Project Step.
- In the Filter Onboarding Project Step Records section:
- Make sure Condition Requirements to Update Records is set to All Conditions Are Met (AND).
- For Field, select Record ID.
- For Operator, select In.
- For Value, select Transform Step IDs.
- Make sure Condition Requirements to Update Records is set to All Conditions Are Met (AND).
- In the Set Field Values for the Onboarding Project Step Records section:
- For Field, select Status.
- For Value, select the Select Steps to Update screen, then New Status.
- For Field, select Status.
- Save the flow.
All done! Notice how the flow canvas looks identical to the previous version, even though the elements’ configurations are quite different. Both versions took about the same amount of time to configure, and take about the same amount of time to run. It’s important to remember when building a flow: There can be a lot of ways to make the same automation happen, and sometimes choosing your flow’s method comes down to personal preference.