Does query task api supports orderby and OR operator clause


#1

I am trying to call “http://localhost:8080/flowable-rest/service/query/tasks” API to fetch cases and I want cases in a specific order. in flowable rest api is it possible to get tasks in a specific order. Also does flowable supports OR operator in query task api.


#2

See:

Yes, for example:

  public getTasks(): Observable<any> {

    const endpoint = `${this.processEngineUriPrefix}runtime/tasks`;

    const sort = 'createTime';
    const order = 'desc';

    const params = new HttpParams().set('sort', sort).set('order', order);

    return this.httpClient.get<TaskListModel>(endpoint, this.getHttpOptions(params))
      .pipe(
        tap(() => {
          this.logger.info('TasksService: getTasks() completed');
        }),
        catchError(this.handleError('getTasks', []))
      );

  }

Also see: Upcomig task for a user


#3

Hi Ronbiyo,

Thanks for your reply.

Below is the sample rest call which we are making
http://localhost:8080/flowable-rest/service/query/tasks
{“includeProcessVariables”:true,
“order”:“asc”,
“processInstanceVariables”:[
{

“name”:“StudentName”,
“operation”:“like”,
“value”:“John%”
},
{

“name”:“StudentName”,
“operation”:“like”,
“value”:“Tru%”
}
],
“size”:“100”}

we are not making "this.processEngineUriPrefix}runtime/tasks’ call.

My requirement is like I want all the records where Student name is either starts with John or Trump.

Could you please help me with this


#4

See: Query for tasks

For example:

curl -H "Content-Type: application/json" -X POST http://admin:test@localhost:8080/flowable-task/process-api/query/tasks -d "@data-6.json"

data-6.json:

{
  "name": "Fill in a Leave Application Form"
}

Response 200 OK:

{
    "data": [
        {
            "id": "0a1c8119-1cfb-11e9-b854-0242ac110002",
            "url": "http://localhost:8080/flowable-task/process-api/runtime/tasks/0a1c8119-1cfb-11e9-b854-0242ac110002",
            "owner": null,
            "assignee": "admin",
            "delegationState": null,
            "name": "Fill in a Leave Application Form",
            "description": null,
            "createTime": "2019-01-20T21:33:34.317Z",
            "dueDate": null,
            "priority": 50,
            "suspended": false,
            "claimTime": null,
            "taskDefinitionKey": "sid-3BA1F4D1-500F-4766-89BF-519166929F2D",
            "scopeDefinitionId": null,
            "scopeId": null,
            "scopeType": null,
            "tenantId": "",
            "category": null,
            "formKey": "leave-application-form",
            "parentTaskId": null,
            "parentTaskUrl": null,
            "executionId": "0a146ac5-1cfb-11e9-b854-0242ac110002",
            "executionUrl": "http://localhost:8080/flowable-task/process-api/runtime/executions/0a146ac5-1cfb-11e9-b854-0242ac110002",
            "processInstanceId": "0a135952-1cfb-11e9-b854-0242ac110002",
            "processInstanceUrl": "http://localhost:8080/flowable-task/process-api/runtime/process-instances/0a135952-1cfb-11e9-b854-0242ac110002",
            "processDefinitionId": "leave-application-process:1:003800be-1cfb-11e9-b854-0242ac110002",
            "processDefinitionUrl": "http://localhost:8080/flowable-task/process-api/repository/process-definitions/leave-application-process:1:003800be-1cfb-11e9-b854-0242ac110002",
            "variables": []
        }
    ],
    "total": 1,
    "start": 0,
    "sort": "id",
    "order": "asc",
    "size": 1
}

#5

Hey @ramling_h,

Currently you can’t do OR queries over REST.

Cheers,
Filip