Java code to get ProcessName ProcessID from BPM.

1
0
-1

Hi All,
I am new to this application and looking for a java code that can get ProcessId, ProcessName, TaskId and TaskName from BPM.

I searched a lot on internet and found following methods that can help to get the result:

getActivitytInstanceUUID()
ProcessDefinitionUUID getProcessDefinitionUUID()
ProcessInstanceUUID getProcessInstanceUUID()

Can Someone help me to understand the procedure to use above methods.

I really appreciate for the help.

-Prakhar

1 answer

1
+1
-1

Use this code:

  1. import org.bonitasoft.engine.api.ProcessRuntimeAPI;
  2.  
  3. //get the API
  4. ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
  5.  
  6. //get the Process Name
  7. String processName =
  8. processRuntimeAPI.getProcessInstance(processInstanceId).getName();
  9.  
  10. //get the Process Id
  11. String processID =
  12. processRuntimeAPI.getProcessInstance(processInstanceId).getId();

For Task (Activity) you will want to have a look at FlowNodeInstance and use getDisplayName.

I will let you figure out how to use this. Call it homework. :)

regards
Seán

PS: If this reply answers your question, please mark as resolved.

Comments

Submitted by praks0000 on Mon, 08/22/2016 - 13:28

Hi Sean McP... I appreciate your quick answer..
Following is my doubt:

I am getting error for the keywords which are in bold format:

package test.app;

import org.bonitasoft.engine.api.ProcessRuntimeAPI;

class TestBonita {
ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
// get the Process Name
String processName = processRuntimeAPI.getProcessInstance(processInstanceId).getName();

// get the Process Id
String processID = processRuntimeAPI.getProcessInstance(**processInstanceId**).getId();

}

Do I need to add anything here for errors??

Can you please share the code with me.??

Thank you. :)

Notifications