Fetching tasks based on the task start date in REST API

cancel
Showing results for 
Search instead for 
Did you mean: 
Tabu
Member II

Fetching tasks based on the task start date in REST API

Hi,

I've been trying to filter the tasks based on property value using WorkflowTaskQuery where I'm implementing setProcessCustProps() method in which I'm passing a list of property-values. 

I was able to fetch some of the properties but when tried with bpm:startDate, bpm:completionDate, it wasn't fetching. 
I tried providing the date in ISO8601 format (bpm:startDate/2019-07-22T16:49:59.000Z) as I'm using task-instances REST API.

Now, I have a requirement to filter the tasks based on date provided which is equal or greater than the task start date before fetching the tasks. I tried searching but didn't find any solution of filtering using WorkflowTaskQuery.

Is there any way to fetch task details by applying task start date filter using WorkflowTaskQuery and should the value provided to the parameter (Ex: bpm:startDate) be in ISO8601 format?

Please do help with the solution.
Thank you!

2 Replies
sanjaybandhniya
Intermediate

Re: Fetching tasks based on the task start date in REST API

Take reference of this Java file.

Here they have provided how to gilter task.

TaskInstancesGet.java

Tabu
Member II

Re: Fetching tasks based on the task start date in REST API

Thanks for the response!

I am taking TaskInstancesGet.java class as a reference.

WorkflowTaskQuery taskQuery = new WorkflowTaskQuery();
taskQuery.setActive(null);
taskQuery.setWorkflowDefinitionName(workflowName);
taskQuery.setTaskState(state);

propertyFilter.put(propertyQName, propValue);
taskQuery.setProcessCustomProps(propertyFilter);
taskQuery.setOrderBy(new OrderBy[]{OrderBy.TaskDue_Asc});

This is the code of WorkflowTaskQuery where in properties are filtered in setProcessCustomProps().

In this code it basically matches with the values & names of the properties then fetches the task details. But when i tried filtering by bpm:startDate the response is empty. My requirement is to fetch all the tasks based on the date provided which is equal or greater than the task start date (bpm:startDate).