Show TOC

Examples of URIs Accessing BPM TasksLocate this document in the navigation structure

This topic shows some examples of how to use uniform resource identifiers (URI) to access BPM tasks or perform an operation on a task.

Filtering Tasks

For collections of tasks, the supported operators for filter expressions are: eq, ne, lt, le, gt, ge, and, or, not, (). The supported function is substringof.

You can optimize task filtering by ensuring that the following conditions are met:

  • Tasks are filtered by one or all of the following properties: Status, Priority, CreatedBy, TaskDefinitionID, CreatedOn, CompletionDeadLine, SubstitutedUser.

  • The or operator is used to logically connect expressions for the same property.

    Example: Status eq 'READY' or Status eq 'RESERVED'

  • The and operator is used to logically connect expressions for different properties, or expressions for the same property if they create a date range.

    Example: Status eq 'READY' and Priority eq 'HIGH'

    Example: CreatedOn ge datetime'2014-01-01T00:00:00' and CreatedOn le datetime'2014-12-31T23:59:59'

  • The following comparison operators are used: eq, ge, le.

Sample Code Filtering by Status property
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'
Sample Code Filtering by Status and TaskTitle properties
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'and TaskTitle eq 'DefaultTask'
Sample Code Filtering by custom attribute, assuming the task has the decimal custom attribute price
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=CustomAttributeData/price ge '1000'
Ordering of Tasks

When ordering tasks you can specify the order direction. The default order direction is ascending (asc).

Sample Code Ordering by TaskDefinitionName property
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'&$orderby=TaskDefinitionName
Sample Code Ordering by simple property and custom attribute, assuming the task has the decimal custom attribute price
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'&$orderby=TaskDefinitionName,
        CustomAttributeData/price
Sample Code Ordering by simple properties with order direction
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'&$orderby=TaskTitle asc, Priority desc
Sample Code Ordering by custom attributes with order direction, assuming the task has the decimal custom attribute price and the decimal custom attribute rate
GET
        /bpmodata/tasks.svc/TaskCollection?$filter=Status eq 'READY'&$orderby=CustomAttributeData/price desc,
        CustomAttributeData/rate asc
User Search
Sample Code Example of a user search
GET
        /bpmodata/tasks.svc/SearchUsers?SearchPattern='John*'&MaxResults=10
Creation of Substitution Rules

You create substitution rules via a POST on the SubstitutionRuleCollection. You need to pass input data according to the SubstitutionRule entity.

Sample Code Example of a substitution rule
POST
      /bpmodata/tasks.svc/SubstitutionRuleCollection/InputData
Getting Number of Tasks

To get a number of tasks, you must specify the $filter query option in the service request URL. The service only considers filter expressions for the Status property of the Task entity type with the value of the $filter query option. The service ignores filter expressions for other properties of the Task entity type without returning an error.

Sample Code Getting a number of ready and reserved tasks
GET
        /bpmodata/tasks.svc/TaskCollection/$count?$filter=Status eq 'READY' or Status eq 'RESERVED'