Designing Get Next Work
Front Stage (FSG) wants its facility coordinators to collaborate with each other to help meet the goal of completing work in eight hours. This goal time prevents escalation to the event manager.
FSG wants the most urgent work assigned to a facility coordinator, even if the work is already assigned to another facility coordinator. When a facility coordinator finishes work on the current assignment, then clicks Next Assignment, the application should be able to assign work from another facility coordinator according to the following requirements:
- The originally assigned facility coordinator has not yet started the assignment.
- The application should select the oldest assignment from all the other facility coordinator’s worklists.
- The facility coordinator must have the skills to perform the assignment on the other facility coordinator's worklist.
- This behavior should only apply to the facility coordinator work group.
The Weather case was created with stages and steps filled out by the business.
The following table provides the credentials you need to complete the exercise.
Design and configure the Get Next Work solution to satisfy the requirements. Consider alternatives and compare the pros and cons to select the best approach.
Facilities coordinators possess the following skills, as do members of the same work group.
Facility Coordinator specialized in Parking
Facility Coordinator specialized in Weather Preparation
Facility Coordinator specialized in Weather Preparation and Parking
1 Solution detail
Configure Booking:FacilityCoordinator access role
For any solution, you need to set up and configure a Booking:FacilityCoordinators access role definition as follows:
- From your exercise system, log on as Admin@Booking
- From DEV Studio > Configure > Org & Security > Tools > Security > Role Names open the existing Booking:User access role.
- Save the Booking:User access role to Booking:FacilityCoordinator and add the new access role to the EventBooking ruleset.
- Click Create and open to create the new Booking:FacilityCoordinator access role name.
- In the Role tab on the access role name record, make sure Clone from displays PegaRULES:User4 and then click Clone.
- At the bottom of the table, click the add row icon to open the Add Access Role object dialog.
- In the dialog, do the following:
- In Access Class, enter Assign-Worklist. This creates a new Access of Role to Object instance.
- In Read instances and Write instances, specify a new access when record named AssignedToMyWorkgroup .
- Next to either field, click the Create rule icon and create the new AssignedToMyWorkgroup access when record with the condition .pxWorkGroup = OperatorID.pyWorkGroup.
- In Delete instances, Read rules, Execute reports, and Execute activities fields, set the value to 5.
- In the Write rules and Delete rules fields, leave them blank.
- Click Save to create the new Assign-Worklist Access of Role to Object and close the dialog.
- On the access role name record, click Save to save the Booking:FacilityCoordinator access role name.
- Open the Booking:FacilityCoordinator access group, add the new Booking:FacilityCoordinator access role name, and remove all the other Available roles.
- Save the access group
2 Recommended approach
The recommended approach is to circumstance the Assign-Worklist GetNextWork list view. This option meets the requirements and has the added benefit of extensibility.
For this approach to work, you add a property that is always visible within the requestor’s context. For example, you can add the PrimaryRole property to the Data-Admin-Operator-ID class. To set the property value with a Rule-Declare-Expression, follow these steps.
- From the Records Explorer, create a new PrimaryRole single value text property. Set Apply to the Data-Admin-Operator-ID class and the ruleset to EventBooking.
- From the App Explorer, find the Data-Admin-Operator-ID class, right click the PrimaryRole property, and select Define expression to create a new Declare Expression rule.
- On the declare expression, do the following:
- In the Expressions tab, set the Primary Role to the Value of @whatComesAfterLast(AccessGroup.pyAccessGroup,':')
- In the Change Tracking tab, set Calculate when to Whenever used and Execute this expression to Regardless of any pages it is contained in.
- Save the declare expression. You can use the property and declare expression later to circumstance additional rules such as the GetNextWorkCriteria decision tree.
This approach mirrors, but does not hide, existing rules. Revealing the rules helps make application upgrades easier.
This example describes how to circumstance the Assign-Worklist GetNextWork list view using the .PrimaryRole property. The PrimaryRole property indicates that the user’s role is Facility Coordinator.
The configuration is as follows:
- In the App Explorer, find and open the existing (Assign-Worklist) GetNextWork list view.
- Specialize the list view using circumstance by property. Specify the property as OperatorID.PrimaryRole and the value as FacilityCoordinator.
- To create the new circumstanced (Assign-WorkList) GetNextWork list view, click Create and open.
- In the Organize tab of the circumstanced list view, set Sort by column .pxCreateDateTime in Ascending Sort order.
- In the Content tab, do the following;
Note: This is the same condition used for the AssignedToMyWorkgroup access when rule.
- Change the existing filter condition from .pxAssignedOperatorID Is equal pxRequestor.pyUserIdentifier to .pxAssignedOperatorID Is not equal pxRequestor.pyUserIdentifier.
- Add a second filter condition to allow every worklist assignment within the user’s work group to be retrieved. This filter condition is .pxWorkGroup = OperatorID.pyWorkGroup.
- Update the Label for each Criteria to A, B, C, and D to accommodate the new condition.
- Update the Logic field to A AND B AND C AND D to accommodate the new condition.
- Save the circumstanced list view.
Circumstance Assign-.GetNextWorkCriteria decision tree the same way as documented in step 2 above. Add the Assign-CurUserHasRequiredSkills when rule to the tree such that the decision rule returns true if the when evaluates to true.
3 Alternative approaches
At least two alternative approaches can be used:
- Add a custom button that runs an Open Assignment action.
- Override Assign-Worklist GetNextWork related rules.
Add a custom button to run an Open Assignment action
In this approach, you add a button to the pyPortalHeader section and the application. When the user clicks the button, the application runs the Open Assignment action. This action requires a key parameter. A non-list data page provides the key, and then calls an activity that you defined.
To get the key:
- Your activity calls the pxRetrieveReportData activity to run your version of the pyWorkGroupWorkList Assign-Worklist report definition.
- The report definition sorts the results by ascending pxCreateDateTime instead of pxDeadlineTime.
- The activity evaluates the Assign- GetNextWorkCriteria decision tree to ensure that the user’s skills match those on the assignment.
- The application copies the assignment to the non-list data page if the decision tree returns a value of true.
- The application uses the pzInsKey of the assignment as the key parameter for the Open Assignment action.
Override Assign-Worklist GetNextWork related rules
In this approach, you override and customize behavior of the Assign- findAssignmentInWorklist activity in this way:
- Save the Assign-Worklist GetNextWork list view to a new name such as GetNextWorkFacilityCoord.
- Create a when rule called IsFacilityCoordinator. Use the selection criteria (@String.whatComesAfterLast (AccessGroup.pyAccessGroup,’ :’) = “FacilityCoordinators”).
- Add the IsFacilityCoordinator when rule condition to the ShowView step. Set the when rule preconditions actions to if true Skip step, if false Continue.
- Add a second ShowView step. This time, configure the IsFacilityCoordinator when rule precondition actions if true Continue, if false Skip step.
- Modify the ShowView activity to run the GetNextWorkFacilityCoord list view. Configure the GetNextWorkFacilityCoord list view in the same circumstanced GetNextWork list view.
Pros and cons of each approach
The following table describes the pros and cons of each approach.
Circumstance Assign-Worklist GetNextWork
Mirrors the existing Assign-Worklist GetNextWork implementation, hence easier to maintain
More easily extended
Requires additional rules such as the PrimaryRole property and Rule Declare Expression
Add a custom button and Open Assignment action
Solution not tightly coupled to Pega rules such as Assign-Worklist GetNextWork ListView
Override Assign-Worklist GetNextWork
Fewest new rules needed
Affects the Assign-Worklist GetNextWork list view behavior for every user