Automating actions when a property value changes
The Payroll Department at TGB reports that some employees enter an incorrect bank name when enrolling in direct deposit. The payroll department requests that the bank name populate based on the routing number entered to avoid errors in Payroll setup cases.
The following table provides the credentials you need to complete the challenge.
|Senior System Architect||SSA@TGB||pega123!|
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.
1 Update the Bank information section
- In Dev Studio, search for and open the section rule ProvideBankInformation_0.
Tip: You can use the search feature or the Records Explorer to locate the section rule. In the Records Explorer, use the filter option to locate the rule of interest.
- Double-click the embedded section to open the Cell Properties dialog box.
- Open the BankInformation section rule.
- Double-click the Bank name field to open the Cell Properties dialog box.
- On the Presentation tab, in the Edit options list, select Read-only (always).
- In the dialog box, click Submit to apply the changes.
- Double-click the Routing number field to open the Cell Properties dialog box.
- In the Cell Properties dialog box, on the Actions tab, for Actions type, select Standard.
- Click Create an action set to add an action set to the field.
- Click Add an event > Change to add a change event to the control.
- Click Add an action > Display: Refresh to add a Refresh-This section action to the field to display the updated bank name to the user immediately when they modify a routing number on the section.
- Click Submit to apply the changes. The section resembles the following image:
- Save the section rule.
2 Create the declare on change and activity rules
- In Dev Studio, open the Records Explorer.
- In the Records Explorer, click Decision > Declare OnChange to open the list of current OnChange instances in the application.
- Click Create to create a new Declare OnChange rule.
- On the new Declare OnChange rule, in the Label field, enter UpdateBankName.
- In the Apply to field, enter TGB-HRApps-Work-PayrollSetup to apply the Declare OnChange rule to the PayrollSetup case type.
- Click Create and open to create the Declare Onchange rule.
- In the Properties To Watch field, enter or select.RoutingNumber as the property to watch for changes.
- In the When field, enter or select Always to run the specified activity every time the routing number changes.
- In the When True Run section, enter the activity name UpdateBankName.
- Next to the activity UpdateBankName field, click the open icon to open the Create Activity form.
- Click Create and open to save the new activity rule as UpdateBankName.
- On the Security tab of the activity rule, in the Activity type list, select Onchange.
- On the Steps tab, configure the activity to apply the UpdateBankName data transform.
Note: In this scenario, the UpdateBankName data transform uses the routing numbers specific to the United States to identify the financial institution with which the account is associated. To learn more about routing numbers in the United States, see List of routing numbers.
- Save the activity rule UpdateBankName and click the Declare OnChange rule tab.
Note: The system displays a warning that the use of activity rules should be limited. The need for activities can be reduced by using data transforms, as well as techniques such as case management, the Engine API, and declaratives. To stay in line with best practices, limit the use of activities.
- Save the Declare OnChange rule UpdateBankName.
Confirm your work
- In the User portal, create a new Payroll Setup case.
- Advance the case to the Provide bank information step.
- In the Routing number field, enter 021001088 and press the tab key to verify that the Bank name field automatically updates to HSBC Bank USA.
- In the Routing number field, enter 124003116 and press the tab key to verify that the Bank name field automatically updates to Ally Bank.
- In the Routing number field, enter 061000104 and press the tab key to verify that the Bank name field automatically updates to Sun Trust Bank.
- In the Routing number field, enter 123107613 and press the tab key to verify that the Bank name field automatically updates to -- (blank).