What are you looking for?

Introducing Task Filters

By
  • Blog
  • >
  • Introducing Task Filters
With Camunda BPM 7.2.0-alpha5, we introduce Task Filters. Task filters are TaskQueries which can be saved to the database so that you can run them repeatedly.

Creating a Filter using Java API

At a Java API Level, a filter can be created as a regular task query:

// create a taskQuery
TaskQuery myTasksQuery = taskService.createTaskQuery().taskAssignee("daniel.meyer").active();

// save taskQuery as filter
Filter myTasksFilter = filterService.newTaskFilter("My Tasks");
myTasksFilter.setOwner("daniel.meyer");
myTasksFilter.setQuery(myTasksQuery);
String filterId = filterService.saveFilter(myTasksFilter);

// execute the filter
List<Task> tasks = filterService.listPage(filterId, 0, 20);

If you want to share the filter with other users and for each user, make should return that particular user’s tasks, it is possible to use Expression Language in the task query:

taskService.createTaskQuery().taskAssigneeExpression("${ currentUser() }").active();

The above example uses the built-in expression currentUser() which returns the userId of the currently authenticated user (set through IdentityService.setAuthentication()).

For more built-in Expression Language functions, see the corresponding User Guide Section.

Filters can also be managed using the REST Api.

Managing Task Filters in camunda Tasklist

With the latest release of camunda Tasklist, you can manage filters. Filters are displayed at the left handside of the Tasklist and can be assigned a Name, a Priority and a Color.

assign approver in tasklist with filters

Creating a new Task Filter

A new filter can be created by selecting the “New filter” button. A dialog opens which allows to configure the filter:

create new filter modal dialog

Defining Filter Criteria

Filter criteria can be defined in the “Criteria” section. In this example we select all tasks by candidate Group and Due Date:

defining filter criteria

Sharing Filters

Filters can be shared with other users and Groups by defining Authorizations. This filter is shared with all users part of the group “management”. They have been granted “READ” permission meaning that they can see and execute the filter but they cannot modify or delete it.

defining Authorizations

What’s next?

With Camunda 7.2 we limit out of the box support for filters to Task Filters. If this is a success, we can think of many more interesting use cases for filters:
  • camunda Cockpit: Process Definition and Process Instance Filters in cockpit
  • Operations Monitoring: define a Filter Query and monitor it via REST from an Operations tool like Nagios
  • Combine Filers and Timer Jobs: At midnight, execute a Filter and for each Task, send a reminder email…

Try All Features of Camunda

Related Content

Build software that meets needs while still protecting the environment for future generations.
Achieve our first certification as a Camunda Certified Professional—Developer.
We've been working hard to reduce the job activation latency in Zeebe. Read on to take a peek under the hood at how we went about it and then verified success.