Wednesday, June 5, 2013

BPM 11g - Starting New Task from ADF with BPM API

One more step in ADF/BPM integration I would like to cover today. This is based on BPM 11g PS6 ADF sample application with included BPM workspace ADF task flow - Customized BPM 11g PS6 Workspace Application. I will show in this post how you can start new process instance from ADF with BPM API.

Sample application - adfbpmapp_ps6_v1.zip implements custom ADF Task Flow with ADF UI Fragment, where regular ADF UI table component is implemented to display current user tasks. Additionally there is a button "Start New Task" to start new process and assign further tasks:


Once "Start New Task" button is pressed, it calls action listener from the backing bean, where BPM functionality is invoked. If task was started successfully and task ID was generated, we are going to report it to the user:


Task is started by getting tasks possible to initialize from BPM context connection for current active user. Process instance is created for such task and task ID is retrieved. In this example I'm getting first available initiable task. BPM API returns initiable task even if user is not granted permission to start it through BPM role, is enough for the user to be part of the process. For this reason there is additional check if user has appropriate BPM swim lane role:


In this example must be granted GroupManagers swim lane role to be able to start new task and call task initializer activity:


User redsam1 is able to start new task through BPM API, information about just started task ID is displayed along with task info in the table:


The same task info is displayed in BPM workspace task flow, where task form can be accessed:


User redsam2 is not granted with GroupManagers swim lane role, and this user can't start new tasks as reported:

7 comments:

M.Ahmed said...

Thanks Andrejus for this post but there is some exception in some imports like
oracle.bpel.services.bpm.common.IBPMContext

and jsp tag libraries like
worklistComponents 1.0 Tag Libraries

Andrejus Baranovskis said...

This is custom ADF/BPM application, you need to point to SOA/BPM libraries in your environment.

Andrejus

Stanislav said...

Hi Andrejus.
Thanks for interesting blog.
But I have a question:
Could you display a task with details
in a custom ADF application?(not within BPM workspace)

Thanks.
Best regards, Stanislav

Andrejus Baranovskis said...

Yes, you would need to get task details through Task API...

Most of the task details should come from DB, you could pass only Task ID - it is easier then, no need to store all the payload in BPM.

Andrejus

Stanislav said...

Do you have any similar samples about this case?

Thanks.
Best regards, Stanislav

Andrejus Baranovskis said...

In this post similar idea is described: http://andrejusb.blogspot.com/2013/06/passing-payload-value-from-adf-to-bpm.html

Andrejus

Stanislav said...

Hi Andrejus.
Thanks for response.
You see, I already have some pages and regions with bindings to the payload. Inside of BPM worklist they work fine, but now I want reuse them in a custom application. So, I have to pass somehow bpm parameters (context, taskId and so on) and invoke the bounded taskflows from my custom ADF application. Have you had anything similar situation?

Best regards, Stanislav