Step 1: Create the Flow component

The first step is to create a Flow component. This Flow component will be part of the Flow twice. The user enters configuration values in the Flow component through Field Mapping.

  • To go to the Flow component, 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.

    1. To define the Flow component, label it as β€œActivityEmailSender”.

    2. To elaborate on the purpose of this Flow component, optionally enter a description.

    3. 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.

circle-info

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, additional 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 add a new field, click [+ Field]. Add nine (9) mapped fields.

  • To set up the Mapped Fields, define the fields as follows:

    1. Mapped Field: β€œCustomerID”, Data Type: β€œstring”. This mapped field will contain Customer ID information.

    2. Mapped Field: β€œFrom”, Data Type: β€œstring”. This mapped field will contain the text displaying which person or team sent the email.

    3. Mapped Field: β€œSubject”, Data Type: β€œstring”. This mapped field will contain the contents of the email subject.

    4. Mapped Field: β€œEmailBody”, Data Type: β€œstring”. This mapped field will contain the contents of the email subject.

    5. Mapped Field: β€œActivityType”, Data Type: β€œstring”. This mapped field will contain the value of the type of activity being recorded for the customer.

    6. Mapped Field: β€œAssignedTo”, Data Type: β€œstring”. This mapped field will contain the information about who the task was assigned to.

    7. Mapped Field: β€œPriority”, Data Type: β€œnumerical”. This mapped field will contain the priority of the activity in terms of a numerical value.

    8. Mapped Field: β€œDescription”, Data Type: β€œstring”. This mapped field will contain the description of the activity.

    9. Mapped Field: β€œEmailType”, Data Type: β€œstring”. This mapped field will contain the description of the type of email e.g. Marketing email.

  • After all fields are defined, the Field Mapping section will be as per the image below.

  • 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.

  • When a Flow component is created, its four (4) predefined Events are displayed in this section:

    1. β€œSuccess”

    2. β€œError”

    3. β€œWasDisabled”

    4. β€œAlreadyRunning”

  • To create a new β€œEvent”, click the [+ Event] button.

  • The Event box displays. It is enabled by default.

  • To define the Event:

    1. Enter the Event name to be displayed.

    2. Enter the Event name for the platform.

  • To associate more Events with this Flow component, create the following additional events.

    1. β€œSent”: This Event is triggered when the email is sent.

    2. β€œOpened”: This Event is triggered when the email is opened.

    3. β€œBounced”: This Event is triggered if the email bounces back i.e. it is not delivered.

    4. β€œLinkClicked”: This Event is triggered when the link in the email is clicked. If a link is provided in the email and the user clicks it, the Event will trigger the Flow component connected to it in the Flow.

  • To configure the icon for this Flow component, click the β€œLangstack” icon on the right-hand side.

  • A dialog box displays. To select the image to load as the Flow component icon, click on the β€œLangstack” icon or β€œUpload icon” button. In this exercise, the Mail icon is selected. (user can choose any image). To save the image, click the [Save] button.

  • The new icon displays.

  • 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.

    1. 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.

    2. 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.

  • To define the target entity, select β€œUserName_Acc_Activities” from the drop-down menu. The created record with this Flow component will be stored in this entity.

  • 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.

  • Label the Action box 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 to be used in the β€œAction box”, expand the β€œAction box” and go to the β€œVariables” tab. To create a new variable to store values, click the [+ Variable] button.

  • To load the records from the entity β€œUserName_Acc_customers” into a variable, define the variable as follows:

    1. Variable Name: β€œCustomer”

    2. Data Type: β€œUserName_Acc_customers”

  • To add Actions, go to the β€œCode” tab in the Action box to add Actions.

  • To load the entity record into the variable β€œCustomer”, add and define this first Action as follows:

    1. Select Action as β€œLoad Entity record”.

    2. From the drop down menu, select the variable β€œCustomer”. The entity record will be loaded into the variable β€œCustomer”.

    3. To configure the criteria settings, click the β€œCriteria settings” icon.

  • To configure the settings for how the records of the entity will be loaded into the variable, in the β€œLoad Entity record” Action criteria settings, define the following fields:

    1. Select β€œOrder by” as β€œCustomer_ID”. The records will be displayed by ordering the β€œCustomer_ID” field.

    2. Sort in β€œAscending” order. The records will be loaded in ascending order.

    3. Create a new β€œMatch key” by clicking the [+ Match key] button.

  • Define the match key as follows:

    1. Select the field β€œCustomer_ID” from the drop down menu. This match key maps the β€œCustomer_ID” field in the entity to the field β€œCustomerID” in the β€œMapped Fields”.

    2. Select the source as Variables>MappedFields>CustomerID>toGUID(). It is displayed as β€œMappedFields.CustomerID.toGUID()”. The value of the β€œCustomerID” provided in the mapped field of the Flow component by the user will be aligned with the β€œCustomer_ID” field (after conversion from Json to GUID) in the entity.

    3. Click the [Save] button.

  • To check if the record is loaded, add another Action and define it as follows:

    1. Select Action as β€œCondition action”.

    2. Enter the description as β€œcheck if the record is loaded”.

  • To define the variables to be used in the β€œCondition action”, expand the β€œCondition action” and go to the β€œVariables” tab. Create two (2) variables.

  • To convert the record in the Customer variable into Json before triggering the Flow component activity, define the first variable as follows:

    1. Variable Name: β€œJS”

    2. Data Type: β€œJson”

  • To update the values of the record fields to be loaded into the entity β€œUserName_Acc_Activities”, define the second variable as follows:

    1. Variable Name: β€œCustomerActivity”

    2. Data Type: β€œUserName_Acc_Activities”

  • To define the criteria for this action, go to the β€œCriteria” tab. To verify if the record is loaded, add and define a Criteria bar as follows:

    1. Select Variables>Customer. It is displayed as β€œCustomer”.

    2. Select the Operator as β€œIs Set”.

  • To define the actions in case the criteria returns a True value, go to the Code tab>On True section.

  • To define a sequence of actions to create an email activity record, define a Group action as follows:

    1. Select Action as β€œGroup action”. The actions defined within a Group action are treated as a group. When the Group action is changed in the position or copied, the changes are applied to all the actions defined within the group.

    2. Add the description as β€œcreate an email activity”. This action contains a sequence of actions to create an email activity and update it in the β€œUserName_Acc_Activities” entity.

  • To create a new Action in the Group action, click the (+) button in the Group action. To update the values of the new record, add nine (9) Actions in the Group action by clicking the (+) button.

  • To update the β€œActivity_AssignedTo” field of the record with the value from the mapped field β€œAssignedTo” (defined in the Details>Field Mapping section), define the first Action as follows:

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_AssignedTo. It is displayed as β€œCustomerActivity.Activity_AssignedTo”.

    3. Select Value as Variables>MappedFields>AssignedTo. It is displayed as β€œMappedFields.AssignedTo”.

  • To update the β€œActivity_CreatedBy” field of the record with the text β€œActivityEmailSender Flow component”, define the second Action as follows:

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_CreatedBy. It is displayed as β€œCustomerActivity.Activity_CreatedBy”.

    3. Type Value as β€œActivityEmailSender Flow component” and press Enter. It will display in a blue bubble.

  • To update the β€œActivity_DateTime” field of the record with the current date, define the third Action as follows:

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_DateTime. It is displayed as β€œCustomerActivity.DateTime”.

    3. Select Value as Functions>DateTime>Now(). It is displayed as β€œDateTime.Now()”.

  • To update the β€œActivity_Description” field of the record with the value from the mapped field β€œDescription” (defined in the Details>Field Mapping section), define the fourth Action as follows. (The value in this field is entered as a string by the user in the Flow component.)

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_Description. It is displayed as β€œCustomerActivity.Activity_Description”.

    3. Select Value as Variables>MappedFields>Description. It is displayed as β€œMappedFields.Description”.

  • To update the β€œActivity_Priority” field of the record with the value from the mapped field β€œPriority” (defined in the Details>Field Mapping section), define the fifth Action as follows.

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_Priority. It is displayed as β€œCustomerActivity.Activity_Priority”.

    3. Select Value as variables>MappedFields>Priority>toInteger(). It is displayed as β€œMappedFields.Priority.toInteger()”. (The value is entered as a string by the user and converted to Integer before creating the record.)

  • To update the β€œActivity_Type” field of the record with the value from the mapped field β€œEmailType” (defined in the Details>Field Mapping section), define the sixth Action as follows. The value is entered as a string by the user in the Flow component.

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_Type. It is displayed as β€œCustomerActivity.Activity_Type”.

    3. Select Value as Variables>MappedFields>EmailType. It is displayed as β€œMappedFields.EmailType”.

  • To update the β€œActivity_Status” field with details including the customer email and the type of email sent, define the seventh Action as follows:

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Activity_Status. It is displayed as β€œCustomerActivity.Activity_Status”.

    3. In the Value, define two (2) values that together display as : β€œEmail sent to the customer email” β€œCustomer.Email”. For example, the email sent to customer email address β€œ[email protected]”, it will be displayed in the entity as β€œEmail sent to the customer email [email protected]”.”

      1. First type constant text as β€œEmail sent to the customer email ” and press Enter. It is displayed in a blue bubble.

      2. In the same field, select Variables>Customer>Email. It is displayed as β€œCustomer.Email”.

  • To update the β€œCustomer_ID” field of the record with the value from the mapped field β€œCustomerID” (defined in the Details>Field Mapping section), define the eighth Action as follows. (The value is entered as a string by the user in the Flow component and converted to GUID before creating the record in the entity.)

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as CustomerActivity>Customer_ID. It is displayed as β€œCustomerActivity.Customer_ID”.

    3. Select Value as Variables>MappedFields>CustomerID>toGUID(). It is displayed as β€œMappedFields.CustomerID>toGUID()”. The value is entered as a string by the user in the Flow component and converted to GUID before creating the record in the entity.

  • To create the record into the β€œUserName_Acc_Activities” entity and get the β€œJXPResponse” when the entity record is created, define the last Action in the Group action as follows:

    1. Select Action as β€œCreate Entity record”.

    2. Click [+] and add a variable named β€œResult”. This variable is of JXPResponse data type and is displayed in the β€œVariables” tab of the β€œAction box”. This variable will contain the response to display when the created record is loaded into the target entity.

    3. Select Value as β€œCustomerActivity”. This variable contains the values of the entity fields updated in the β€œGroup action”.

  • To update the customer entity record into a json variable before triggering the Flow component Event, add another Action by clicking the (+) button in the β€œAction box” after the β€œGroup action” (within the β€œOn True” section).

  • To update the target variable β€œJS” with details in the Customer variable,define the Action as follows:

    1. Select Action as β€œUpdate Variable”.

    2. Select Target variable as β€œJS”.

    3. Select Value as Variables>Customer>toJson(). It is displayed as β€œCustomer.toJson()”.

  • To trigger the Flow component event with an event Sent, add the last Action as follows:

    1. Select Action as β€œTrigger Flow component event”.

    2. Select JXPFlowAppActivity as β€œSource”.

    3. Enter the Event name as β€œSent”.

    4. Select Details json as β€œJS” (Variables>JS).

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

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

  • To enable the Flow component, in the Details tab click the toggle button to set it as β€œEnabled”.

Last updated