Saturday, June 15, 2013

Passing Payload Value from ADF to BPM Process Task

This post describes how to pass payload value from ADF programmatically and assign it to the BPM process task. This is one of the important points for ADF/BPM integration, along with programmatic process task initialization we are able to assign process task payload and pass dynamic values.

Sample process from demo BPM app -  adfbpmapp_ps6_v2.zip, works with Employee type payload. Employee data is submitted in the input and output of the process task:


Process is initialized programmatically, AssignEmployee task is process automatically by completing this step from ADF through BPM API. User is navigated to AssignEmployeeReview task automatically - this is how sample process works:


Once new process task is initialized, we are setting payload variable based on initialized task ID and processing the task. From the same bean, tasks table is refreshed by the ADF poll component to display latest changes. BPM process task starts asynchronously and ADF UI may not display it immediately:


Payload value is assigned by getting task payload XML element and setting value by ID. In this example only Employee ID variable is initialized for the payload:


BPM process works in the similar way as ADF Task Flow - navigation between process tasks is controlled by outcomes. As you can see SUBMIT outcome is defined in the task definition:


Finally ADF UI part defines ADF Poll component to reload tasks table automatically every 10 seconds to display asynchronously started BPM task list:


User redsam1 selects employee row - 101 in this test:


Goes to Assigned Tasks tab and from there starts new process (payload for Employee ID is retrieved from current row set in Employee Data tab):


As you can see from the screenshot above - task was created, but not yet displayed in the list. Since list is auto refreshed - it will be loaded in the next 10 seconds:


If you go to the standard workspace task flow and display associated human task UI for selected process task, it will display Employee ID 101 from process payload assigned by method in ADF:


Submit selected task for further processing, payload value will be transfered by BPM to the approver redsam2 user:


Through BPM process instance tracker we can double check - payload was set programmatically correctly, value 101 is displayed:

7 comments:

Achinto Banerjee said...

Hi Andrejus ,
Do i need to be on ps6 to compile and run this sample . Currently i an using the ps5 vm and see errors when I try to open the BPM sample in my jdev ps5.

Is there a VM image for ps6 available.
Thanks,
Achinto

Andrej Baranovskij said...

Yes, I was creating this sample with PS6, however same logic works on PS5. I dont think so - there is only PS5 VM. You would need to build PS6 VM by yourself.

Andrejus

Achinto Banerjee said...

Thanks , will install the ps6 . One more question, I see as payload to Human task / process you are passing the Employee Id along with all other attributes associated to it . As a design decision should we design the payload is similar way as best practise or should it be light weight just passing the employee id. Also since you are passing the whole employee object as payload does it make more sense to have the application persistence logic as well as part of the process using ADF BC exposed Services called from BPM process.
Thanks,
Achinto

Andrej Baranovskij said...

I'm passing only EmployeeId, other attributes are not assigned. You should keep payload as smaller as possible.

Andrejus

Anonymous said...

Hi Andrejus, very helpfull your post.
It works for me! I have another question, its possible to set defaults values on row creation for childs records? For example, addresses of an employee.

Thanks!

Andrej Baranovskij said...

Yes, why not. You could do it with ADF operations.

Andrejus

Anonymous said...

Hi Andrejus,
Great blog!! We are currently implementing BPM and ADF and was wondering if it was possible to update the task and then refresh the bindings so they can be used in the task flow for other conditional processing? We are able to successfully update the task, but we can not get the attribute bindings to get refreshed. For example, refreshing the task details iterator...
Thanks,