Step 1: Check if the join date matches the current date
To check if the join date matches the current date, follow the steps below.
To go to the Process template, select βProcessβ under the Background processes menu on the left side panel.

In the Background processes>Process tab, click the [+ Process] button.

To label the Process and enable it, go to the βDetailsβ tab. In the βDetailsβ tab:
Enter the Process name as βCustomerJoinDateAnniversaryNotificationβ.
Optionally enter the description for the Process.
Ensure the Process is enabled.

To disallow multiple requests simultaneously, leave the toggle button enabled for βskip execution while in progressβ. Enabling this toggle button defines that the execution of this Process will be skipped when there is one already in progress.

The default value for Process execution is selected as βImmediateβ. For this exercise, keep it as is.

To define the shared variables, go to the βVariablesβ tab. This tab consists of the shared variable βStartupParametersβ with the data type βListβ.

To add a variable, click the [+ Variable] button.

Add and define (2) shared variables:
To have a variable to hold the day and month of the current date, define the first variable as follows: Variable Name: βstrDayMonthTodayβ, Data Type: βstringβ.
To have a variable to hold the current date, define the second variable as follows: Variable Name: βcurrentDateβ, Data Type: βDateTimeβ and initialize it to βDateTime.Now()β (Navigate to Functions>DateTime>Now).

To create a new Target Entity, go to the βTarget Entitiesβ tab and click [+ Target Entity]. This Target entity is where the Process will update the records.

To define the target entity, select the βTarget Entityβ from the drop-down menu as βUserName_Acc_Activitiesβ.

To add the sequence of actions to check if the current date matches the customer's join date, go to the βCodeβ tab. To create a new βAction boxβ, click the [+ Action box] button.

To calculate the day and month of today, label the Action box as βCalculate DayMonth of todayβ. This is the first βAction boxβ in which the value for the βDayMonthJoinDateβ (field in the entity βUserName_Acc_customerβ) for the current day will be evaluated and stored in the record to be updated.

To define variables for the actions in this Action box, go to the Action box>Variables tab. To create a new variable, click the [+ Variable] button. Create three (3) variables.

To store the value of the current date as a string, define a variable as follows: Variable Name: βcurrent_daymonthβ, Data Type: select βstringβ.

To store the value for the month in the current date, define a variable as follows: Variable Name: βcurrent_monthβ, Data Type: βstringβ.

To store the value for the day in the current date, define a variable as follows: Variable Name: βcurrent_dayβ, Data Type: βstringβ.

To add an action, go to the Action box>Code tab of the βAction boxβ and click the (+) button.

To update the variable with the βcurrent_dayβ with the day's value in the current date, define the added Action as follows:
Select Action as βUpdate Variableβ.
Select the Target variable as βcurrent_dayβ.
Select Value by navigating the dropdown Functions>DateTime>Now()>Day()>toString(). It will display as βDateTime.Now().Day().toString()β. The current day's value is first converted to string and then updated to the variable βcurrent_dayβ.

To update the variable with the βcurrent_monthβ with the month's value in the current date, add and define another Action as follows:
Select Action as βUpdate Variableβ.
Select the Target variable as βcurrent_monthβ.
Select Value by navigating the dropdown Functions>DateTime>Now()>Month()>toString(). It will display as βDateTime.Now().Month().toString()β. The current month's value is first converted to string and then updated to the variable βcurrent_monthβ.

To add a zero in case the month is of 1 digit, add and define an Action as follows:
Select Action as βCondition actionβ.
Enter the label as βif month is 1 digit, add a zeroβ.

To check if the length of the month's value is equal to 1, add and define a Criteria bar as follows:
Select Source as Variables>current_month>length(). It displays as current_month.length().
Select Operator as βIs Equalβ.
Enter Value as β1β and press Enter.

If the Criteria is returned as true, define an Action in the Code tab>On True section as follows:
Select Action as βUpdate Variableβ.
Select the Target variable as βcurrent_monthβ.
Define Source as follows:
In the Source, type β0β without quotes and press Enter.
Navigate the dropdown and select Variables>current_month.

To update the variable with the βcurrent_daymonthβ with the month's value in the current date, add another Action after Condition action and define it as follows:
Select Action as βUpdate Variableβ.
Select the Target variable to be βcurrent_daymonthβ.
Select Value as follows:
Navigate and select the βcurrent_dayβ variable.
Navigate and select the βcurrent_monthβ variable.

To traverse the entity βUserName_Acc_customersβ for comparing the values of the customer's join date with the current date, define the Action as follows:
Select Action as βTraverse Entityβ. This action will traverse an entity.
Select entity βUserName_Acc_customersβ. This entity will be traversed.
In the field βTreat element in the list asβ, the variable named βitemβ is automatically created and populated. This item contains the value of each element in the list of the records read from the βUserName_Acc_customersβ entity.

To set up the criteria for Traverse Entity selected as βUserName_Acc_customersβ, click the "Criteria Setup" icon.
To define settings for the traverse such that the entity can be traversed in order by the βDayMonthJoinDateβ in the entity in ascending manner, set the criteria as follows:
Order By: βJoin_Dateβ. This defines that the records to be traversed will be ordered by the Join_Date field of the entity.
Ascending: the records to be traversed will be ordered in an ascending manner, i.e., the joining date of the oldest value will be displayed first.

To add a Match Key, click the [+ Match key] button.

To define a Match key:
Select the field as βDayMonthJoinDateβ.
Select Variables>current_daymonth. It displays as βcurrent_daymonthβ. The field βDayMonthJoinDateβ will be matched with the variable βcurrent_daymonthβ. This match key defines that only those records will be traversed in which the DayMonthJoinDate's value is the same as the values of day and month in the current date.
To save the settings, click the [Save] button.

To define Variables for Actions in the Traverse Entity Action, go to Variables. A variable βitemβ is already created.

Add two (2) more Variables.
To store the value for the existing anniversary, define the first variable as follows:
Variable Name: βexisting_anniversaryβ
Data Type: βUserName_Acc_Activitiesβ

To send a response, define the second variable as follows:
Variable Name: βnew_anniversaryβ
Data Type: βUserName_Acc_Activitiesβ

To define the actions for the Traverse Entity Action, go to the Code tab and add a new Action.
To find the first item in the list of entity records, define the first Action as follows:
Select Action as βFind first List itemβ
Select Target variable as βexisting_anniversaryβ
Select Source List as Variables>item>Customer_Activities. It displays as βitem.Customer_Activitiesβ.

To define the criteria for the βFind first List itemβ Action, click on the βSetup criteriaβ icon.
Based on the Filter Settings, if a record for an Anniversary is already created for a customer and the record creation date is the current date, then that record (in the variable βitemActivitiesβ) will be updated into the variable βJoinDateAnniversaryListβ. If by the end of this traverse, βJoinDateAnniversaryListβ is empty, a new record will need to be created. If it has any record, the new record will not be created. To set up the Filter Settings, add two (2) Criteria bars by clicking the (+) button.
To check if the Activity Type in the traversed record is equal to βAnniversaryβ, define the first Criteria bar as follows:
Select item>Activity_Type. It displays as βitem.Activity_Typeβ.
Select Operator as βIs Equalβ.
Type the text βAnniversaryβ and press Enter. The text displays in a blue bubble. This Criteria bar checks if the value of the βActivity_Typeβ in the traversed record matches the type βAnniversaryβ.

To check if the Activity_Type in the traversed record is created today, define the second Criteria bar as follows:
Select item>Activity_DateTime. It displays as βitem.Activity_DateTimeβ.
Select Operator as βIs todayβ.

To set the criteria such that both the Criteria bars must return βTrueβ, keep the logical operator as βANDβ. If both of the Criteria bars return βTrueβ, no new record will be created. To save the Filter Settings, click the [Save] button.

Add a new action in the Traverse entity action and define it as follows:
Select Action as βCondition actionβ.
Enter the description as βif the anniversary exists, skip the customerβ.

To check if the value for the βexisting_anniversaryβ is received, in the Criteria tab add a new Criteria bar:
Select Source as Variables>existing_anniversary. It displays as βexisting_anniversaryβ.
Select the Operator as βIs Setβ.

To define the action if the criteria is True, in the Code tab>On True section add an Action βContinue List Traverseβ.

To add a group of actions for assigning values to the record fields, a new Action after the Condition action and define it as follows:
Select Action as βGroup actionβ.
Enter the description as βupdating the anniversary fieldsβ.

In this Group action, the actions will be configured to update the values of the fields of the target entity βUserName_Acc_Activitiesβ through the variable βnew_anniversaryβ. Add six (6) actions.
To update the variable βnew_anniversaryβ with a value for the field βActivity_AssignedToβ in the entity, define the first Action as follows:
Select Action as βUpdate Variableβ.
Select Target variable as new_anniversary>Activity_AssignedTo and press Enter. It will display as βnew_anniversary.Activity_AssignedToβ.
Enter Value as βsales teamβ (without quotes) as constant text. This text will be displayed in the field for the record.

To update the variable βnew_anniversaryβ with a value for the field βActivity_Typeβ in the entity, define the second Action as follows:
Select Action as βUpdate Variableβ.
Select Target variable as new_anniversary>Activity_Type and press Enter. It will display as βnew_anniversary.Activity_Typeβ.
Add the Value as βAnniversaryβ (without quotes) and press Enter. This text will be displayed in the field for the record.

To update the variable βnew_anniversaryβ with a value for the field βActivity_CreatedByβ in the entity, define the third Action as follows:
Select Action as βUpdate Variableβ.
Select Target Variable as new_anniversary>Activity_CreatedBy and press Enter. It will display as βnew_anniversary.Activity_CreatedByβ.
Enter Value as βanniversary processβ (without quotes) and press Enter. This text will be displayed in the field for the record.

To update the variable βnew_anniversaryβ with a value for the field βActivity_Descriptionβ in the entity, define the fourth Action as follows:
Select Action as βUpdate Variableβ.
Select Target variable as new_anniversary>Activity_Description. It will display as βnew_anniversary.Activity_Descriptionβ.
Add the Value as βthis is the anniversary of the customerβs joining date.β (without quotes) and press Enter. This text will be displayed in the field for the record.

To update the variable βnew_anniversaryβ with a value for the field βActivity_DateTimeβ in the entity, define the fifth Action as follows:
Select Action as βUpdate Variableβ.
Select Target variable as new_anniversary>Activity_DateTime. It will display as βnew_anniversary.Activity_DateTimeβ.
Select the Value as Functions>DateTime>Now(). It will display as βDateTime.Now()β. This will update the field for the record with current date information.

To update the variable βnew_anniversaryβ with a value for the field βCustomer_IDβ in the entity, define the sixth Action as follows:
Select Action as βUpdate Variableβ.
Select Target variable as new_anniversary>Customer_ID and press Enter. It will display as βnew_anniversary.Customer_IDβ.
Select the Value as Variables>item>Customer_ID. It will display as βitem.Customer_IDβ.

The Group action will look as per the image below.

To create a new record, add a new Action after the Group action. To update the values of the fields updated in the variable (by the first six actions) into a variable createRecord and create the record in the target entity, define the Action as follows:
Select Action as βCreate Entity recordβ. This action creates a new record in the Target Entity and its related entities.
Add a new variable by clicking [+] and name it βanniversary_responseβ. To save this variable, click the [Save] button. This variable will be the data type JXPResponse variable and will display the success or failure of the record creation.
Select Entity variable as βnew_anniversaryβ. The information of the fields stored in this variable will be populated in the newly created record in the target entity.

To save the Process, click the [Save] button.
To publish the Process, click the [Publish] button.
For this exercise, skip the upcoming steps with the βTrigger Flowβ action as these are a part of exercises in Introduction to Flows & Flow components. Save and publish the Process, and proceed to Test the Process section.
Triggering Flow
To trigger a flow, add a new action after "Create Entity record" and follow the steps below:
To check if the record is created successfully, add and define an Action as follows:
Select Action as βCondition actionβ.
Enter the description as βcheck if creation is successfulβ.

To check if the error code is equal to β0β, in the Criteria tab, add a Criteria bar as follows:
Select Variables>anniversary_response>errorcode. It displays as βanniversary_response.errorcodeβ.
Select Operator as βIs Equalβ.
Type the Integer value as β0β and press Enter. The text displays in a blue bubble.

To configure the Flow βCustomerActivityCreatedβ to be triggered when this Process is executed, in the Code tab>On True section, add and define an Action as follows:
Select Action as βTrigger Flowβ.
Select Flow as βCustomerActivityCreatedβ.
Select Entity variable as Variables>new_anniversary. It is displayed as βnew_anniversaryβ.
Details Json field is empty.

To display the Activity_ID of the created record on the Test Console, add the last Action and define it as follows:
Select Action as βDisplay on test consoleβ.
Select Variables>new_anniversary>Activity_ID. It will display as βnew_anniversary.Activity_IDβ.

To save the Process, click the [Save] button.

To publish the Process, click the [Publish] button.

Last updated
