06-20-2018 08:51 AM
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
06-21-2018 04:04 AM
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?
06-21-2018 06:02 AM
Yes. I want to do a query that returns process instances based on form field values.
I am using APS 1.7.
06-21-2018 07:23 AM
You can query based on process variables values. For example,
POST api/enterprise/historic-process-instances/query
{"variables":[{"name":"myVar","value":"US","operation":"equals"}]}
06-22-2018 07:26 AM
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?
06-26-2018 12:16 PM
multiple values can be submitted using data tables.
06-27-2018 01:03 AM
Can you please provide any example or documentation link?
06-27-2018 04:38 AM
Sorry I meant dynamic tables can be used for multiple values (rows).
06-27-2018 07:57 AM
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?
06-27-2018 08:40 AM
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();
Explore our Alfresco products with the links below. Use labels to filter content by product module.