Thursday, June 16, 2011

Pinning tasks to a user in BPM 11g

Scenario:
A BPM process with 1 swimlane - Supervisors(e.g. mtwain, jcooper, rsteven)
An order enters the system and is then processed via 2 human tasks.

Task 2 should be assigned to the supervisor that processed task 1.



Ergo, if jcooper logs in to workspace and claims/approves ApprovePart1, then ApprovePart2 should be assigned to her.

Assign ApprovePart1 to the Supervisor group



Assign ApprovePart2 to whoever approved the previous task i.e. ApprovePart1

The Human Workflow service provides us with the following function -

hwf:getPreviousTaskApprover()

According to the Description –

Get the previous task approver. The signature of this function is hwf:getPreviousTaskApprover(taskId). The arguments are: 1) taskId - The task id of the task Returns an XML element user, in the namespace http://xmlns.oracle.com/bpel/services/IdentityService, that contains the previous approver user id.

So we need to pass it the taskID of ApprovePart1.

We need to get this from the execData structure so return to the data mapping for ApprovePart1 -



You see I have also created a process variable v_taskid of type String.

Now I need to specify this v_taskid value as the parameter to hwf:getPreviousTaskApprover(). My basic solution here is to copy it to one of
the flexfields in my payload. I'm sure there are more elegant ways of doing this.





Now we can return to the definition of the 2nd Task and add in the parameter.



Auto-generate the ADF task forms and deploy.

Test



Login to BPM workspaces as jcooper



Task has been assigned to the group.

Approve




Task2 has been assigned to jcooper

2 comments:

Lucas Jellema said...

Very nice. Thanks for sharing this.

Lucas

Niall Commiskey said...

My pleasure!