CSV To Object Mapping StepLast Updated: 07/15/2016 Introduced in Verision: 2.0 |
This tutorial demonstrates how to use CSV To Object Mapping step. This step can be found in Data > List > Excel and CSV category in the ToolBox.
Example:
In this Example we are going to create a Flow that creates an Array of Account Objects from CSV file using CSV To Object Mapping step. Then, for each Account in the Array our Flow will create an Account in Portal.
We begin in the Designer Folder with clicking Create Flow button on the Folder Actions panel.
Then, we Name our Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Create or Copy Data step from All Steps [Catalog] > Data category in the Flow Designer Wizard.
In the resulting Data Definitions window we click Add New link to add new data definition.
We need to define Data that can hold our CSV file. We Name our Data and pick FileData Type. Then, we can click Ok to save and close this window.
After we defined our Data we can click Add in Data Definitions window to continue.
Next, we can pick a CSV file for Data we have just defined. CSV file for this tutorial looks as following… It has 4 rows of data. Each row has 3 field: First Name, Last Name, and Email Address.
We select Create or Copy Data step on the workspace and Step Information Layer pops up. We use Value picker for the File Data to select our CSV file. Then, we click Add Step to add next step in our Flow.
We add CSV To Object Mapping step from All Steps [Catalog] > Data > List > Excel and CSV category.
Next, we are going to configure CSV To Object Mapping step. We select it on the workspace and Step Information Layer pops up. First, we select Csv from Input File Type dropdown in the Input Data section.
Then, in Output Data section we select Account Type using Output Type picker.
In the Inputs section we pick Select Value for the File Input Mapping type.
Next, using Path picker for the File Input we select File data outcome from Create or Copy Data step.
We can close Step Information Layer and select Show Item Mapping Editor from CSV To Object Mapping Options Menu.
In the Item Mapping Editor we select Build Data Mapping type for ITEM field.
Then, we expand _INPUT category. In our CSV file Email Address is stored in the third column. We expand Field03 and connect its TextValue to the EmailAddress field for our Account object.
In the same manner we connect TextValues from Field01 and Field02 to the First Name [Person Info] and Last Name [Person Info] fields in our Account object. Then, we click Ok to save and close Item Mapping Editor.
Next, we click Add Step in the Step Information Layer for the CSV To Object Mapping step.
We add ForEach Step from All Steps [Catalog] > Flow Management category.
In the resulting pop-up window we need to pick a collection for the ForEach Step. We select OUTPUTS collection of Accounts (outcome from CSV To Object Mapping step). Then, we click Add to continue.
On the Next outcome from ForEach Step we add Create Account step form Integrations > All Integrations > Accounts category.
Next, we connect Done outcome from Create Account step back to the ForEach Step, and Done outcome from the ForEach Step to the End Step in our Flow. We select Show Mapping Editor Option for the Create Account step.
In the Mapping Editor we expand Item outcome from the ForEach Step. Then, we connect EmailAddress to the emailAddress. We are going to use User’s First Name for password field. When finished, we can save and close Mapping Editor.
This completes our Flow. We click Debug Flow link on the Top Panel in the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.
Flow opens in the Debugger and executes with no errors.
If we inspect Output Data from the CSV To Object Step, we can confirm that four new Accounts were created from CSV file.
Single Input Data for the Create Account step should look as following…
If we close Flow Designer and navigate to the Accounts Folder in the Portal we can validate that four new Accounts were added to the Portal.