Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Search for tasks that belong to running process instances

Avatar

Level 3

Hi, I am trying to search for tasks that belong to running process instance by using the follwoing code:

     ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
     TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(myFactory);

     TaskSearchFilter filter = new TaskSearchFilter();
     filter.setServiceName(serviceName);
     filter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_STATUS, Operator.EQUALS, JobStatus.JOB_STATUS_RUNNING);

     filter.setAdminIgnoreAllAcls(true);

     List<TaskRow> result = queryManager.taskSearch(filter);

It returns no results while I search it via adminui I found a few running process instance. I tried to comment out the line addCondition, then it returns all tasks, and I found that when I retrieve the taskinfo by taskinfo.getProcessInstanceStatus(), it return -1 for all tasks.

My question is how can I set the condition to search the tasks belong to running process instance? Thanks.

0 Replies

Avatar

Level 10

I have been away on vacation ......do you get an answer for this query?

Paul

Avatar

Level 3

Now I've created a variable storing the process status, and then search by the variable instead of using the TaskSearchingConstants.

Avatar

Level 1

You have to use:

filter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_STATUS, Operator.EQUALS, ProcessInstanceRow.STATUS_RUNNING);