cancel
Showing results for 
Search instead for 
Did you mean: 

Get "Ready" "Reserved" or " In Progress" Task for Subprocess using BPM API

Former Member
0 Kudos

Hi Gurus. i have developed a BPM process that uses a subprocess, everything works fine, the process starts , assigns tasks and execute correctly the subprocess.

My problem is the following:  I'm developing  a WebService  and  im using  the  BPM API to know where the task is where in status "Ready", "Reserved" or in "Progress" for each process (The principal),  when the active task is in the principal process my webservice works fine and i can see the task,   but when it is in a subprocess I can’t find it.


I wrote this code to find tasks, like i have only the "process instance" for the principal process, passed this in the method signature:

protected String getCurrentTaskName(String strProcesInstance) throws CustomException{

   String taskActualName = "";  

   try {

      // create URI

      URI uriProcessInstanceId =  new URI(strProcesInstance);

      //Define Statuses

      HashSet<Status> statuses = new HashSet<Status>();   

      statuses.add(Status.READY);

      statuses.add(Status.RESERVED);

      statuses.add(Status.IN_PROGRESS);

      // Get Task Instance manager

      TaskInstanceManager taskInstanceManager = BPMFactory.getTaskInstanceManager();

      // Get Task abtract

            Set<TaskAbstract> taskAbstracts = taskInstanceManager.getTaskAbstractsByParent(uriProcessInstanceId, statuses);

      // Get Task name

      for (TaskAbstract taskAbstract : taskAbstracts)

      taskActualName = taskAbstract.getName();

       } catch (Exception e) {

       throw new CustomException("Unable to get the current task", e);

      }

    return taskActualName;

}

For example given this process instance :36d6c9852a8411e2bfb30000009421ae , Of browse in the Manage Process, its seems like this:

When select "Show Related Task", can see task for process and subprocess  ("Mostrar_Resultado" is a task of subprocess):.

Did you know how i can get the current task for sub-process with BPM API?.

Basically I'm looking for ways to get the "process instance" of a sub-process started by another process, with which I can reuse the same method and get the tasks

Best Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi everybody

I was reviewing this issue directly with SAP staff, and this was the answer:

Dear Ramiro, et al,

unfortunately the desired functionality cannot implemented with the currently available API. There is no possibility to navigate from a process instance to its parent or even root instance.

However, there are options to implement this:

  1. 1.       Create a local persistency where you maintain the relations between the process instances via their instance-ID. By this you can traverse the process instances and retrieve the task instance of each process instance.
  2. 2.       The local persistence can be build using for instance CAF or JPA.

We actually plan to ship this functionality as part of the BPM API with SAP NetWeaver BPM 7.3.1, SP8 which is planned to be available in Q3 this year. There you will be able to obtain the parent and root for a certain process instance programmatically.

I hope this information can help you in your implementation .

Best regards,

I hope this information can help you in your implementation.

Best regards.

Answers (0)