Hello,
I have one process which has task and form fields. And I have one field "location" which I am considering as business key. For example, I have 2 locations as: India and UK. I want to fetch the process instances of these two locations. Means I need to pass the multiple business key values. Is it possible to pass the multiple business key values and fetch the process instances of these 2 business key values [multiple business key values]?
Thanks & Regards
Shilpa Kulkarni
I'm not sure I understood what are you trying to do. Do you want to do a query that returns process instances based on those values (form field values)?
Can you also specify whether you are using Activiti or APS and what version?
Yes. I want to do a query that returns process instances based on form field values.
I am using APS 1.7.
You can query based on process variables values. For example,
POST api/enterprise/historic-process-instances/query
{"variables":[{"name":"myVar","value":"US","operation":"equals"}]}
Thank youbassam.al-sarori for the solution. It worked for me. In my case I want to pass multiple values for the value. For example, I have to pass "US", "India", "UK" etc... as value. Is this possible to pass multiple values at once?
multiple values can be submitted using data tables.
Can you please provide any example or documentation link?
Sorry I meant dynamic tables can be used for multiple values (rows).
I want to fetch the process instances of multiple locations. For this I am using following swagger api:
For this I have passed the process variable value as you suggested.
If I pass single location name then it is working properly.I am getting the process instances of that location . I have tested this in the postman. I am attaching here those screens:
Scenario 1: Fetching process instances of puna location(by variables [name as location and value as puna])
For this request I am getting following response[this location has 2 records[process instances] so I am getting those 2 records:
Scenario 2: Fetching process instances of banglore location(by variables [name as location and value as banglore])
For this request I am getting following response[this location has 3 records[process instances] so I am getting those 3 records:
Scenario 3: I want to fetch the process instances of these 2 locations [banglore and puna]. I am sending request as follows:
Ideally I should get the process instances of those 2 (bangloe and puna)locations. I should get 5 records in the response. But I am not getting any records but still response code is 200. I am getting the response as follows:
Why I am not getting the records if I pass multiple locations for variable value[Scenario 3]? Am I passing request in proper format or is there any other way to pass the multiple values for the variables for fetching the process instances?
The query will check for process instances that have all the variables included in the request.
{"variables":[
{"name":"foo","value":"bar","operation":"equals"},
{"name": "location", "value":"US", "operation":"equals"}
]
}
The above will return only processes that have both "foo" and "location" with the specified values. The query uses the "AND" clause.
You can create a custom REST endpoint that uses HistoricProcessInstanceQuery (Activiti - Engine 5.22.0 API)
historyService.createHistoricProcessInstanceQuery()
.or()
.variableValueEquals("location", "US")
.endOr()
.or()
.variableValueEquals("location", "UK")
.endOr()
.list();
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.