Skip to main content

Designing Get Next Work


4 Tasks

20 mins

Visible to: All users
Advanced Pega Platform 8.3.1 English
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded. Click here to continue your progress in the latest version.


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.

Role Operator ID Password
Author Admin@Booking rules


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.

Department Role Operator ID


Facility Coordinator specialized in Parking



Facility Coordinator specialized in Weather Preparation



Facility Coordinator specialized in Weather Preparation and Parking


Detailed Tasks

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:

  1. From your exercise system, log on as Admin@Booking
  2. From DEV Studio > Configure > Org & Security > Tools > Security > Role Names open the existing Booking:User access role.
  3. Save the Booking:User access role to Booking:FacilityCoordinator and add the new access role to the EventBooking ruleset.
  4. Click Create and open to create the new Booking:FacilityCoordinator access role name.
  5. In the Role tab on the access role name record, make sure Clone from displays PegaRULES:User4 and then click Clone.
  6. At the bottom of the table, click the add row icon to open the Add Access Role object dialog.
  7.  In the dialog, do the following:
    1. In Access Class, enter Assign-Worklist. This creates a new Access of Role to Object instance.
    2. In Read instances and Write instances, specify a new access when record named AssignedToMyWorkgroup .
    3. Next to either field, click the Create rule icon and create the new AssignedToMyWorkgroup access when record with the condition .pxWorkGroup = OperatorID.pyWorkGroup.
    4. In Delete instances, Read rules, Execute reports, and Execute activities fields, set the value to 5.
    5. In the Write rules and Delete rules fields, leave them blank.
  8. Click Save to create the new Assign-Worklist Access of Role to Object and close the dialog.
  9. On the access role name record, click Save to save the Booking:FacilityCoordinator access role name.
  10. Open the Booking:FacilityCoordinator access group, add the new Booking:FacilityCoordinator access role name, and remove all the other Available roles.
  11. 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.

  1. 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.
  2. 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.
  3. On the declare expression, do the following:
    1. In the Expressions tab, set the Primary Role to the Value of @whatComesAfterLast(AccessGroup.pyAccessGroup,':')
    2. In the Change Tracking tab, set Calculate when to Whenever used and Execute this expression to Regardless of any pages it is contained in.
  4. 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.

Example configuration

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:

  1. In the App Explorer, find and open the existing (Assign-Worklist) GetNextWork list view.
  2. Specialize the list view using circumstance by property. Specify the property as OperatorID.PrimaryRole and the value as FacilityCoordinator.
  3. To create the new circumstanced (Assign-WorkList) GetNextWork list view, click Create and open.
  4. In the Organize tab of the circumstanced list view, set Sort by column .pxCreateDateTime in Ascending Sort order.
  5. In the Content tab, do the following;
    Note: This is the same condition used for the AssignedToMyWorkgroup access when rule.
    1. Change the existing filter condition from .pxAssignedOperatorID Is equal pxRequestor.pyUserIdentifier to .pxAssignedOperatorID Is not equal pxRequestor.pyUserIdentifier.
    2. 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.
    3. Update the Label for each Criteria to A, B, C, and D to accommodate the new condition.
    4. Update the Logic field to A AND B AND C AND D to accommodate the new condition.
  6. Save the circumstanced list view.
  7. 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.

Design choice Pros Cons

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

  • Need to add redundant or custom error handling
  • Next Assignment needs to be hidden for Facility Coordinators

Override Assign-Worklist GetNextWork

Fewest new rules needed

Affects the Assign-Worklist GetNextWork list view behavior for every user

4 Solution download

Get Next Work Challenge Solution RAP

Available in the following mission:

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice