Step 1: Create the Flow component
The first step is to create a Flow component.
To open the Flow component template, click βFlow componentβ under the βBackground processesβ menu on the left side panel.

To create a new Flow component, click [+ Flow component].

The βDetailsβ tab is selected by default.
To label the Flow component, enter a meaningful Flow component name. In this exercise, label it as βUserName_createlistofcustomersβ.
To elaborate on the purpose of this Flow component, enter a description.
To store information/logs regarding the execution of the Flow component and associated events, create a βFlow Progression Entityβ labeled as UserName_flowApp_progressionβ by clicking the [+] button.

To enable execution of multiple requests, disable βSkip execution while in progressβ by clicking the toggle button.


By default, it is enabled. If this remains enabled then the Flow component will not be triggered for the other requests while one request is in progress. Since more than one request will be received simultaneously, if one customer request is in progress, other requests will be skipped.
To define the Mapped Fields, expand the βField Mappingβ section by clicking on the arrow. Mapped Fields are input fields for this Flow component. (When the Flow component is placed in a Flow, the user can assign values to these fields in the form of constant text or from relevant sources before executing the Flow.) To create a new field, click [+ Field].

To define the mapped field for this Flow component, go to the Field Mapping section. select the following values:
In the Mapped Field, enter βcustomer_idβ.
The data type is selected as βstringβ. Keep as is for this exercise. Note: At least one mapped field is mandatory in a Flow component. In this case, it has been defined as customer_id.

To expand the βEventsβ section, click on the βEventsβ arrow. In this section, the users define the events that may be triggered during the execution of the Flow component.

To view the predefined Events for this Flow component, go to the Events section. By default, four (4) events are already created and enabled. For this exercise, do not create additional events.

To view the predefined variables for the Flow component, go to the βVariablesβ tab. Two (2) variables are already defined to store the values entered by the user in defining the Flow component Mapped Fields.
Variable Name: βSourceβ, Data Type: βJXPFlowAppActivityβ. This variable contains a number of elements relevant to the Flow component activity in a Flow that hold a certain value.
Variable Name: βMappedFieldsβ, Data Type: βjsonβ. Mapped fields contain the values in Json format.

To create a new βTarget entityβ, go to the βTarget Entitiesβ tab and click the [+ Target entity] button.

Select the Target entity as βUserName_Acc_customersβ from the drop-down menu. This is the entity where the customer records will be created once triggered in the Flow.

To define a sequence of actions to create an entity record in the target entity, go to the βCodeβ tab. To create a new βAction boxβ, click the [+ Action box] button.

The βAction boxβ is default labeled as βDescriptionβ. To make the description of the βAction boxβ more meaningful, click on the βDescriptionβ text and enter the text as βcreate anniversary email recordβ. In this βAction boxβ, the necessary actions will be added and configured to create an anniversary email record for the customer.

To define the variables for this βAction boxβ, go to the βVariablesβ tab. To create a new variable, click the [+ Variable] button.

To define the variables to receive the Json request from the API and send the response, create two (2) variables. Define the variables as follows:
Variable name: βrequestJSβ, Data type: βJsonβ. This variable contains the details received from the API.
Variable name: βresultβ, Data type: βJXPHttpRestResponseβ. This variable contains the Rest Response.

To add a sample of the βrequestJSβ variable, click the [Sample] button.

To define the sample Json, add the following Json in the Sample Schema View. This Json defines that a list of customers will be stored in this variable.
{ "customerslist": [{"Address": "first Street","City": "","Customer_Value": 5,"Country": "USA","Email": "[email protected]","First_Name": "Jane","IsActive": true,"Join_Date": "2021-09-15","Last_Name": "Doe","Phone": "1237865","Rating": 1000,"Zip_Code": "45" }]}The sample Json will look as per the image below. The βcustomerslistβ becomes a field in the βrequestJSβ variable. (The same sample will also be added in the API during API creation.) To save the settings, click the [Save] button.

To create the actions for this Flow component, go to the Code tab and create a new Action by clicking the (+) button.

To store the details from the API source in the Json variable, define the first Action as follows:
Select Action as βUpdate Variableβ.
Select Target Value as βrequestJSβ.
Select Source Value as Variables>Source>Details. It displays as βSource.Detailsβ.

To traverse the list of customers received, add another Action and define it as follows:
Select Action as βTraverse Listβ.
Select Target Value as Variables>requestJS>customerslist. It displays as βrequestJS.customerslistβ.
The field βTreat each element in the list asβ is populated with the Variable βitemβ. The βitemβ represents the individual item in the list being traversed.

The βitemβ variable is automatically listed in the Traverse List variables. To define variables to store the entity record, add a variable by clicking the [+ Variable] button.

To store entity fields, define the variable as follows:
Variable name: βcustomerβ
Data type: βUserName_Acc_customersβ

To load the entity fields from the matching fields in the item (Json), add a new Action in the Traverse List Action and define it as follows:
Select Action as βUpdate Entity fields from jsonβ. This action updates entity fields from the matching fields in the Json.
Select Target Value as βcustomerβ.
Select Source Value as Variables>item. It is displayed as βitemβ.
Select βunset missing valuesβ. So that If the field is not found in the json request, the Action will set the field in the target variable as unset.

To create an entity record after the entity fields are loaded, add another Action in Traverse List Action by clicking the (+) button and define it as follows:
Select Action as βCreate Entity recordβ. This action creates a new record to the Target Entity.
Add a new variable by clicking [+] and name it as βcreateResultβ. Click the [Save] button to save this variable. This variable will be the data type JXPResponse variable and will display the success or failure of the record creation. Also, this variable will be automatically created in the variables tab of the traverse action.
Select Entity variable as βcustomerβ.

To save the Flow component, click the [Save] button.

To publish the Flow component, click the [Publish] button.

To enable the Flow component, ensure it is enabled.

Last updated
