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:

    1. Enter the Process name as โ€œCustomerJoinDateAnniversaryNotificationโ€.

    2. Optionally enter the description for the Process.

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

    1. 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โ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select the Target variable as โ€œcurrent_dayโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select the Target variable as โ€œcurrent_monthโ€.

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

    1. Select Action as โ€œCondition actionโ€.

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

    1. Select Source as Variables>current_month>length(). It displays as current_month.length().

    2. Select Operator as โ€œIs Equalโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select the Target variable as โ€œcurrent_monthโ€.

    3. Define Source as follows:

      1. In the Source, type โ€˜0โ€™ without quotes and press Enter.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select the Target variable to be โ€œcurrent_daymonthโ€.

    3. Select Value as follows:

      1. Navigate and select the โ€œcurrent_dayโ€ variable.

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

    1. Select Action as โ€œTraverse Entityโ€. This action will traverse an entity.

    2. Select entity โ€œUserName_Acc_customersโ€. This entity will be traversed.

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

    1. Order By: โ€œJoin_Dateโ€. This defines that the records to be traversed will be ordered by the Join_Date field of the entity.

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

    1. Select the field as โ€œDayMonthJoinDateโ€.

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

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

    1. Variable Name: โ€œexisting_anniversaryโ€

    2. Data Type: โ€œUserName_Acc_Activitiesโ€

  • To send a response, define the second variable as follows:

    1. Variable Name: โ€œnew_anniversaryโ€

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

    1. Select Action as โ€œFind first List itemโ€

    2. Select Target variable as โ€œexisting_anniversaryโ€

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

    1. Select item>Activity_Type. It displays as โ€œitem.Activity_Typeโ€.

    2. Select Operator as โ€œIs Equalโ€.

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

    1. Select item>Activity_DateTime. It displays as โ€œitem.Activity_DateTimeโ€.

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

    1. Select Action as โ€œCondition actionโ€.

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

    1. Select Source as Variables>existing_anniversary. It displays as โ€œexisting_anniversaryโ€.

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

    1. Select Action as โ€œGroup actionโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target variable as new_anniversary>Activity_AssignedTo and press Enter. It will display as โ€œnew_anniversary.Activity_AssignedToโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target variable as new_anniversary>Activity_Type and press Enter. It will display as โ€œnew_anniversary.Activity_Typeโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target Variable as new_anniversary>Activity_CreatedBy and press Enter. It will display as โ€œnew_anniversary.Activity_CreatedByโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target variable as new_anniversary>Activity_Description. It will display as โ€œnew_anniversary.Activity_Descriptionโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target variable as new_anniversary>Activity_DateTime. It will display as โ€œnew_anniversary.Activity_DateTimeโ€.

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

    1. Select Action as โ€œUpdate Variableโ€.

    2. Select Target variable as new_anniversary>Customer_ID and press Enter. It will display as โ€œnew_anniversary.Customer_IDโ€.

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

    1. Select Action as โ€œCreate Entity recordโ€. This action creates a new record in the Target Entity and its related entities.

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

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

  1. To check if the record is created successfully, add and define an Action as follows:

    1. Select Action as โ€œCondition actionโ€.

    2. Enter the description as โ€œcheck if creation is successfulโ€.

  1. To check if the error code is equal to โ€œ0โ€, in the Criteria tab, add a Criteria bar as follows:

    1. Select Variables>anniversary_response>errorcode. It displays as โ€œanniversary_response.errorcodeโ€.

    2. Select Operator as โ€œIs Equalโ€.

    3. Type the Integer value as โ€œ0โ€ and press Enter. The text displays in a blue bubble.

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

    1. Select Action as โ€œTrigger Flowโ€.

    2. Select Flow as โ€œCustomerActivityCreatedโ€.

    3. Select Entity variable as Variables>new_anniversary. It is displayed as โ€œnew_anniversaryโ€.

    4. Details Json field is empty.

  1. To display the Activity_ID of the created record on the Test Console, add the last Action and define it as follows:

    1. Select Action as โ€œDisplay on test consoleโ€.

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