In this post we will more in detail about the commonly used two types of assignments in Pega..
Worklist and Workbasket
Generally what do you mean by assignments?
- A piece of work allocated to someone.
BPM – Business Process Management. Pega is a BPM tool. Every BPM application involves processing Cases and works.
Who will be processing this work?
- It can be performed either by someone or it can be automated.
- So, If a particular task is to be performed by someone, then we can say he/she is assigned to a task.
Let’s relate this with Pega.
Loan Approval process
Consider bank ABC provides personal loan. ABC bank uses Pega application for loan processing.
I will explain the above picture
Step 1: Person A fill the loan request application and applies the loan.
Step 2: Bank receives the loan and creates a loan request case. Say Loan – 1. (Case creation can be initiated by many ways like Service Email or any other services)
Step 3: Now the case Loan – 1 is assigned to a workbasket.
What do you mean by workbasket?
- I would say workbasket is a parking place for work.
- Cases / work waits here until some people or some automation process handles it.
Step 4: Now bank employee can pull cases from the workbasket and process the case individually.
It means the cases are moved from workbasket assignment to worklist assignment.
What do you mean by worklist?
- Worklist means the list of cases / works assigned to individual operators.
Step 5: After processing the request, employee sends the case to bank manager worklist. Bank manager can either approve or reject the case.
Case is resolved.
Now technically, the case lifecycle can be described in 5 steps
- Case creation
- Assigned to workbasket – waits for bank employee
- Assigned to worklist – bank employee picks and process the request.
- Assigned to worklist – bank manager approves / reject the request.
- Case resolved.
First let’s create a new loan request case with simple stages and steps. In the middle explain more about worklist and workbasket 🙂
My Initial design is to have 4 stages.
In the case creation stage, I am going to collect the information.
What are other pre-requisites?
1. Actors / Operators
I am going to use 2 actors.
Step 1: Create 2 operator IDs using the above names.
Note: Ideally, both operators can have their own access group with roles. To stay in context of this tutorial, I provided them with default manager access group
Now let’s see how to create a new workbasket.
Step 1: Records -> Organization -> Workbasket ->right click Create
You can specify the workbasket name and description
Note: Always provide some meaningful name. My suggestion is to append queue at the endJ
Step 2: Fill out the workbasket form.
Type – Standard / Robotic. This was introduced recently supporting robotic automatic. Let’s select standard.
Still I need to explore a lot about robotic automation!
- You have to specify the organizational structure to which this workbasket belongs.
- We can use our current org / div / unit name.
Work group – group of related people working together. Ideally in every application we have different work groups for different people. I will make a separate post shortly.
For now use your default organization workgroup. Mine is Default@PKS.
- You can list the operators that are related to this workbasket.
Say for example, Bank clerk should be notified whenever a new loan request arrives in the workbasket. Then you can include the bank clerk operator ID in the contacts array. It accepts more than one operator.
Then you can use default activities like NotifyAssignees or NotifyAllAssignees to notify the contacts 🙂
- For now we leave it blank
- This will provide the security for the workbasket.
Say for example, you need only Bank employees to pick items from the workbasket and process the loan request, then you can add the Bank employee role in the Roles array.
Then only operators who possess the specified role can pick up the cases from workbasket 🙂
- For now we leave this too blank!. Save the Workbasket rule form.
Now let’s configure a new Loan request case
Step 1: Case Designer – Add a new case type Loan request
Step 2: Add the 4 stages.
Step 3: Start adding steps
Stage 1 – Add a collect information step
- Click on configure view and Input the fields. I am just collecting some basic information.
Stage 2 – we will configure the process manually.
Stage 3 – use Approval / reject shape.
- You can specify Route to – specific user and specify the Bankmanager operator ID. You can also assign the case to work basket here.
Specific user – Worklist
Work queue – workbasket
Step 4 – Resolve the case.
Stage 2 – Process Creation
- Let’s create a new process for stage 2 manually. All you have to create is a new flow rule.
As per our design, In the second stage first we need to route the assignment to workbasket and then it will be routed to bank employee worklist.
Step 1: Go to stage 2 and use the dropdown icon and select “Add process”.
Type the process name as loan processing and save the rule.
Then click on Open process on the right side to open the flow rule created by case designer.
There you see a new flow created with a single assignment shape. Now you can customize this flow as like as you want 🙂
Step 2: Workbasket assignment
How to configure a workbasket assignment?
Note: In our case already an assignment shape is added by case designer.
- Include the assignment shape from the Add shapes icon.
- Double click on the assignment shape to configure the assignment.
Routing – Who should complete this step
Current operator – Route to the current operator who is executing this flow. – Worklist assignment
Operator – In the dropdown you can select any operator to whom you can assign this assignment – Worklist assignment
Work queue – In the dropdown you can select any workbasket name – Workbasket assignment.
Custom – you can write your custom activity of type Assign and use your own logic. – Worklist / Workbasket assignment.
Use business logic – You can use a decision tree to return the user to whom you can assign – Worklist assignment.
In Our case select Work queue and then select the LoanProcessingQueue workbasket name.
Note: As a best practise, do not hardcode workqueue names directly, Instead try to make use of DCR functionality. But I am hardcoding in this demo
- Save the rule.
Let me remind you one thing
Assignment – A step that requires human input.
It means the assignment shape out connector should always use a flow action rule to perform user input. So whenever the flow enters the assignment shape, it waits either in workbasket or worklist until user performs any action 🙂
As of now, I am including some dummy OOTB flow action. ( the only reason is I don’t want to drag this post!!)
Note: You can create your own flow action and section with input fields.
Now let’s test the workbasket assignment
Step 1: launch the user portal and create a new Loan request case. L-7
Here is the first stage where we collect the information.
Step 2: Click on submit.
The next step is routed appropriately —??? Yeah its in workbasket 🙂
Step 3: Check on the Work queues widget and click on the workbasket.
- You can see the case L-7 is routed appropriately 🙂
Let’s go back and repeat the steps. Before clicking on Submit in step 2, turn on the tracer.
Remember to check DB query in tracer settings.
Let’s analyse the tracer output
Step 1: On submitting the collect information, assignment is completed and then second stage is entered. Flow ‘LoanProcessing’ starts.
Step 2: Activity of type ‘Route’ – ToWorkbasket is called. This is a router activity and accepts the workbasket name as parameter.
Step 3: Then the flow assign starts with new assignment creation.
How Pega saves the assignment?
- Pega persists the assignment.
- It means the a new assignment is saved in dedicated database table.
Step 4: AddAssign activity is called. This activity creates a page ‘newAssignPage’ and saves the details to database table.
—- EDIT after publish—-Note: Whenever you open an assignment, you can see all the assignment details in the newAssignPage.
- Open the Assign-Workbasket class and use test connectivity.
You can see it is mapped to pc_assign_workbasket table. It means all assign-workbasket instances will be stored in pc_assign_workbasket table.
Also note the key of the Assign-Workbasket class.
pxRefObjectKey – pzInsKey of the case.
pxFlowName – In our case LoanProcessing
- Remember no two instances can have the same class keys. So what do you understand here?!
- It means for a case, you cannot have more than one assignment within a single flow. Let me put the other way around. A case can have more than one assignment. This paves the way for parallel processing J
Finally in tracer you can see an insert query was executed in pc_assign_workbasket table.
It’s time to check in database table.
I used the below query
select pxcreatedatetime,pxassignedoperatorid,pxflowname,pxrefobjectkey,pxrefobjectinsname from pc_assign_workbasket where pxRefObjectInsName = ‘L-9’
pxAssignedOperatorID – the column name speaks. Identify to whom the assignment is assigned. In our case it is workbasket name – LoanProcessingQueue
pxFlowName – LoanProcessing
pxRefObjectKey – Reference Object key . Loan request L-9 pzInsKey.
pxRefObjectInsName – Reference object pyID. – L-9
Now let’s see about worklist assignment processing
I will make tis short, since this is the exact replica of Workbasket
Step 1: Add a new assignment shape behind the workbasket assignment in LoanProcessing flow.
Loan request review
Route to – Current operator. It means the case will be assigned to the bank employee who picks the case from the workbasket.
Note: My next post is on GetNextWork where we can avoid this cherry picking of cases 🙂
Again I used Actionstub as flow action. Save the rule
Step 2: Login as BankEmployee1. Click on the Loan processing queue workbasket.
Let’s open L-8 this time
Start the tracer on click of submit.
- ActionStub flowaction just displays the current step 😛
Wait…… you need to remote trace the requestor – bank employee.
Open tracer and start remote tracing bankEmployee1
- You can L-8 is assigned to current operator. Loan request review
Tracer shows ToCurrentOperator is called to assign the case.
Assign-Worklist class is assigned to pc_assign_worklist table.
Let’s go to database and query the pc_assign_worklist table.
Just alter the table name and case ID in previous query . That’s it 🙂
You can see it is assigned to BankEmployee1.
So what happens to the previous workbasket assignment?
Rerun the workbasket query
You can see the assignment is removed.
I hope this is enough for workbasket and worklist 🙂
Note: To display the workbasket and worklist assignments use report definition on the respective tables.
Hope you enjoyed this long post!
See ya in next post on GetNextWork.