Is it possible to get task ID from API?

1
0
-1

Hello,

I created a dashboard page of an application.
I get a list of tasks based on the example :

../API/bpm/process?s=Modify Pending Vacation Request &p=0&c=1&o=version%20DESC&f=activationState=ENABLED

I would like to send the URL with taskId of each task.
for example,
/bonita/portal/resource/taskInstance/vacationProcess/1.0/Select%20option/content/?id={{taskId}}

On the page, is it possible to get taskId using persistenceId of each task?

Any help would be appreciated.
Thanks in advance.

Comments

Submitted by antoine.mottier on Tue, 08/13/2019 - 11:54

../API/bpm/process?s=Modify Pending Vacation Request &p=0&c=1&o=version%20DESC&f=activationState=ENABLED will get you information about the process definitions currently enabled with the name, display name or version matching "Modify Pending Vacation Request" (because you are using s parameter -> search whereas f -> filter). So this API call will not get you information about task instances.

Also note that persistenceId is an information related to business data object.

Can you confirm that your goal is to build a list of pending task instances for a given process definition with the link to the task form?

Submitted by whitedong_1350377 on Tue, 08/13/2019 - 15:00

Thank you for your comment.

Yes, my goal is to build a list of pending task instances for a given process definition with the link to the task form.

Yes, I retrieved all pending tasks by API :../API/bdm/businessData/com.company.model.Project01?q=findByStatusAndRequester&p=0&c=1000&f=requesterNAME={{session.user_name}}&f=status=Active

Then, I would like to link to the task form (one page not inside the portal list) based on the example
'/bonita/portal/form/taskInstance/' + teamSelectedRow.taskId
In the example, the taskId from the restAPI extention.

How can I set the task ID inside BDM?
Or is there another way to resolve this?

Many thanks :)

Submitted by antoine.mottier on Tue, 08/20/2019 - 18:34

Note that the API call: ../API/bdm/businessData/com.company.model.Project01?q=findByStatusAndRequester&p=0&c=1000&f=requesterNAME={{session.user_name}}&f=status=Active does not give you directly information about tasks instances but rather give you a list of business objects values. Those objects, depending on the way they were defined in your business data model, might include for example a task instance id.

Can you share your project as a .bos file (using Google Drive, Dropbox...)? Then I can take a look at your BDM definition.

If you want to store the task instance id in your business object you can configure a Groovy script connector on your task, set the script to return the variable activityInstanceId (that is the task instance id) and in the script output configuration select your business variable, for the "operator type" choose "Use a Java method" and select the appropriate "setter" to update the business variable attribute.

An alternative would be to store only the process instance id (also available as a variable in Groovy script editor, can be used in business variable default value). Then using the API, the process instance id and the task name you can actually find the task instance and its id.

No answers yet.
Notifications