searchTasks by Bussiness Data

I have an IS flowservice that searchs “active” tasks of a particular “processModelID”, and I want to refine the search adding a new search term to filter only tasks with a particular business data in the TaskData.

My flowservice uses the service pub.task.taskclient:searchTasks with the following inputs as an example:


  • includeTaskData = “true”

  • user = “administrator”

  • TaskSearchQuery.Terms[0].Fields[0] = “status”

  • TaskSearchQuery.Terms[0].Operator = “=”

  • TaskSearchQuery.Terms[0].Value = “active”

  • TaskSearchQuery.Terms[1].Fields[0] = “processModelID”

  • TaskSearchQuery.Terms[1].Operator = “=”

  • TaskSearchQuery.Terms[1].Value = “itemRelease”

  • TaskSearchQuery.Terms[2].Fields[0] = “#{currentTask.TaskData.Item.No}”

  • TaskSearchQuery.Terms[2].Operator = “=”

  • TaskSearchQuery.Terms[2].Value = “1203

There are active tasks for this Item Number “1203” and process model “itemRelease”, but the service does not output any task.

But if I remove the third term (Terms[2]) the service search results includes tasks with the item number 1203!!.

Is there any requirement I skipped in the use of this service?


Is it 8.2 ? in that case you can index the fields and then try searchTasksIndexed service.

Yes, 8.2.
The documentation of pub.task.taskclient:searchTasksIndexed indicates the following:

“…The query must contain a search term specifying the taskTypeID when searching for business data fields. The Task Engine uses the taskTypeID to identify the specific index table to use. You can search for multiple task types in a single query by specifying multiple taskTypeID values when you define the search criteria. If you are not searching for business data fields, then a taskTypeID is not required…”

But I don’t want to filter by task type id’s (only by process model id).

…Use this service only when working with indexed business data fields. If you are working with standard business data fields, use pub.task.taskclient:searchTasks…

According to this paragraph, searchTasks can be used to filter tasks by data fields without indexation and without taskTypeIDs. Isn’t it?

The searchTasks documentation does not indicate that indexed fields is needed.

Then why not work?

Hi Alejandro,

It seems that your conditions are correct in ideal case it should work.
Could you try providing the Operator as ‘Contains’ in term[2] instead of ‘=’…worth a try :smiley:

Also please re check if you are binding the field with correct variable (Item.No) ?

The operator ‘contains’ is for “string List fields” only (I tried without success because my field Item.No is String type).
And the correct field is that: #{currentTask.taskData.Item.No} (‘No’ is a field of a document reference ‘Item’ in the ‘taskData’)
(I don’t get fully understand why the documentation indicates the use of the format #{…} in IS when this format is for JSF binding)
Thanks anyway, Prateek.

I did not want but, in my tests, the service pub.task.taskclient:searchTasks also searches business data only if you pass the taskTypeID (is not satisfied with the processModelID :cry: ), although this is not documented (only documented in the cousin searchTasksIndexed)

The reason of my need is to find if an “Item” has an active process associated (that is, at least one active task of a particular processModelID) But, as I have seen, there is no possibility of skipping the tasktype level search (you know: you have to pass the whole list of process model task types you want to find, and maintain this list with the process changes).

I don’t know if there is another way to achieve my goal.


don’t know if i got you right! There are services in WmMonitor package for getting all process instances(pub.monitor.process.instance:getInstanceList) then getting their steps(pub.monitor.process.instance:getInstanceSteps)
and then may be you can search inside steps for active tasks(search for steps having ‘WF’ in ‘SYSTEMDECODE’ of the output and for status see the value in ‘STATUSDECODE’).

One simple work around for this is to store the key search field (Item.ID in your case) in TaskInfo/CustomTaskID. Then you can search all tasks based on customTaskID and process model ID without having to provide task type ID.

This will also improve search performance considerably as there is no need to traverse through task data of all tasks in the system which is stored in DB in BLOB format.

But if you want to search on more than one task data field, then you have to go with using WmMonitor services to find out the tasks as suggested by Anjni

Or use Indexed search with multiple task type ID’s as you will have details of all the tasks in a Process model in advance.
You may need to perform some additional checks to see if process instande ID of the resulting tasks are active or not.