Retrieving the contextual variable processInstanceId and parentProcessId from the UI.

1
0
-1

Hi everyone,
I’m currently trying to retrieve a business data object keyed by the processInstanceId via a filtered query. Unfortunately, I can’t figure how to access the processInstanceId or the parentProcessId from the UI.

Any thought

Thx
david

Comments

Submitted by Dibyajit.Roy on Wed, 06/08/2022 - 14:57

Good question.

I make it a point to create a separate column in database to store the Process Instance Id manually.

Have you tried the below API

../API/bdm/businessData/com.company.model.Table?q=find&p=0&c=100

Submitted by daarnone on Wed, 06/08/2022 - 15:39

thx Dibyajit,

I did too store the process Id , and it seems to retrieve the associated one , but it's a little bit magic.

Using the API is difficult , because i need to filter it . I try to do it , by storing the processInstanceId in a process's variable, trying to retrieve it via ../API/bpm/caseVariable?processId inspired by an example fund under https://github.com/Bonitasoft-Community/process-variable-example/

david

Submitted by Dibyajit.Roy on Wed, 06/08/2022 - 17:38

You can write your own Custom JPQL inside the BDM queries. You can define the parameters and output.
By creating a JPQL , you can have your own filter conditions. JPQL can be accessed through REST API.

Saving the Process Instance Id in a Process variable is not good because then after the case is archived, you will lose access to process variable.

Below is another variation

../API/bdm/businessData/com.company.model.Table?q=findByPersistenceId&p=0&c=100&f=persistenceId={{persistenceId}}

If the case is still active , use the context variable to manage the data.
If the Case is archived , use the REST API to pull the Data.

regards

Submitted by daarnone on Mon, 06/13/2022 - 17:37

thx again Dibyajit for your helpfull insights,

I got some difficulty getting the persistenceId or storageId by looking at Rest Api Context | Bonitasoft Community without success.

I have to switch to another project but hopefully will be back ASAP.

regards

1 answer

1
0
-1
This one is the BEST answer!

Hi David,

If your UI is a Task form you may use /API/bpm/userTask/:userTaskId and retrieve the rootCaseId and parentCaseId attributes (Documentation reference).

HTH
Romain

Comments

Submitted by daarnone on Wed, 06/22/2022 - 12:56

Thx All,

Perfect, I should have read the API more attentively angry_smile.png

According to the advice , i can finally access to my entity , following is the screenshot of the variables inside the UI tool

Name Value Type

context ../API/bpm/userTask/{{taskId}}/context External API
entity {{entityLink}} External API
entityLink return '../' +
$data.context.myAddressCondition_ref.link; Javascript
storageId return
$data.context.myAddressCondition_ref.storageId; Javascript
taskId id URL parameter

All the Best

david

Notifications