access activiti:formkey using activiti-rest in version 5.13

jignesh11
Champ in-the-making
Champ in-the-making
Hi,

I have upgraded activiti version in my application from 5.11 to 5.13 . I use activiti-rest service.

in version 5.11, when I call GET request service/tasks?assignee=kermit then I get formResourceKey in the data section of the response. (formResourceKey is defined as activiti:formkey in bpmn xml file).

but in version 5.13 I use similar GET request runtime/tasks?assignee=kermit but I do not get any formResourceKey. I have had a look at the user guide of both versions and I found that difference in user guide too.
So, my question is how to get form resource key (defined in bpmn xml file) attached to a task in version 5.13 by using activiti-rest.

I also have had a look at these two links.

http://www.activiti.org/userguide/index.html#externalFormRendering
http://www.activiti.org/userguide/index.html#formProperties

but it does not specify anything about getting formResourceKey using activiti-rest.

Awaiting for your reply

Thanks

9 REPLIES 9

frederikherema1
Star Contributor
Star Contributor
Use GET form/form-data instead, passing in taskId (or processDefinitionId)…

b_schnarr
Champ in-the-making
Champ in-the-making
I am facing the same problem. Why was the formResourceKey attribute removed when querrying a task? In my opinion, this attribute belongs to a task in the same way like assignee or duedate…

jbarrez
Star Contributor
Star Contributor
What REST call are we talking about here? I can see formKey in the TaskResponse class.

b_schnarr
Champ in-the-making
Champ in-the-making
When you want to have a list of tasks with
<code>GET request service/tasks?assignee=kermit</code>

the JSON does not include the Form-key Information.

jbarrez
Star Contributor
Star Contributor
You are using the wrong url. See http://activiti.org/userguide/index.html#restTasksGet. it needs to be /runtime/tasks.

I checked it, and it has the formkey:

<code>
{
     "owner": "owner",
     "tenantId": "",
     "processDefinitionId": "oneTaskProcess:1:4",
     "processInstanceUrl": "http://localhost:9898/service/runtime/process-instances/5",
     "delegationState": null,
     "url": "http://localhost:9898/service/runtime/tasks/8",
     "suspended": false,
     "variables": [],
     "taskDefinitionKey": "theTask",
     "processInstanceId": "5",
     "id": "8",
     "createTime": "2014-12-08T15:02:40.196+01:00",
     "executionId": "5",
     "parentTaskId": null,
     "category": null,
     "description": "Usertask",
     "processDefinitionUrl": "http://localhost:9898/service/repository/process-definitions/oneTaskProcess:1:4",
     "assignee": "kermit",
     "dueDate": "2014-12-08T15:02:40.196+01:00",
     "priority": 50,
     "formKey": "myForm.json",
     "parentTaskUrl": null,
     "executionUrl": "http://localhost:9898/service/runtime/executions/5",
     "name": "my task"
}
</code>

b_schnarr
Champ in-the-making
Champ in-the-making
Sorry for this mistake. For sure, I am using this url:
<code>http://host:8080/activiti-rest/service/runtime/tasks?assignee=kermit&start=0&size=1000</code>

And I get:
<code>
{
      "id": "25546",
      "url": "http://activiti.ebusiness.local:8080/activiti-rest/service/runtime/tasks/25546",
      "owner": null,
      "assignee": "kermit",
      "delegationState": null,
      "name": "Formular ausfüllen",
      "description": "Bitte geben Sie den zuständigen Sachbearbeiter an.",
      "createTime": "2014-10-17T13:16:30.332+0000",
      "dueDate": null,
      "priority": 50,
      "suspended": false,
      "taskDefinitionKey": "usertask1",
      "tenantId": "",
      "category": null,
      "parentTaskId": null,
      "parentTaskUrl": null,
      "executionId": "25540",
      "executionUrl": "http://activiti.ebusiness.local:8080/activiti-rest/service/runtime/executions/25540",
      "processInstanceId": "25540",
      "processInstanceUrl": "http://activiti.ebusiness.local:8080/activiti-rest/service/runtime/process-instances/25540",
      "processDefinitionId": "activitiReview:1:35124",
      "processDefinitionUrl": "http://activiti.ebusiness.local:8080/activiti-rest/service/repository/process-definitions/activitiRe...",
      "variables": []
    },
</code>

Seems like this is a bug in Activiti 5.16 Snapshot…

jbarrez
Star Contributor
Star Contributor
Hmmm odd. Which snapshot are you using? There hasn't much changed in the rest api recently.

I tried it here again, with two tasks and I'm getting

<code>
{
     "order": "asc",
     "size": 2,
     "sort": "id",
     "total": 2,
     "data": [
          {
               "owner": null,
               "tenantId": "",
               "processDefinitionId": "oneTaskProcess:1:4",
               "processInstanceUrl": "http://localhost:9898/service/runtime/process-instances/8",
               "delegationState": null,
               "url": "http://localhost:9898/service/runtime/tasks/11",
               "suspended": false,
               "variables": [],
               "taskDefinitionKey": "processTask",
               "processInstanceId": "8",
               "id": "11",
               "createTime": "2014-12-08T20:28:34.000+01:00",
               "executionId": "8",
               "parentTaskId": "5",
               "category": null,
               "description": "Process task description",
               "processDefinitionUrl": "http://localhost:9898/service/repository/process-definitions/oneTaskProcess:1:4",
               "assignee": null,
               "dueDate": "2014-12-08T20:28:34.000+01:00",
               "priority": 50,
               "formKey": null,
               "parentTaskUrl": "http://localhost:9898/service/runtime/tasks/5",
               "executionUrl": "http://localhost:9898/service/runtime/executions/8",
               "name": "Process task"
          },
          {
               "owner": "owner",
               "tenantId": "",
               "processDefinitionId": null,
               "processInstanceUrl": null,
               "delegationState": "pending",
               "url": "http://localhost:9898/service/runtime/tasks/5",
               "suspended": false,
               "variables": [],
               "taskDefinitionKey": null,
               "processInstanceId": null,
               "id": "5",
               "createTime": "2014-12-08T18:28:34.000+01:00",
               "executionId": null,
               "parentTaskId": null,
               "category": null,
               "description": "Description one",
               "processDefinitionUrl": null,
               "assignee": "gonzo",
               "dueDate": "2014-12-08T18:28:34.000+01:00",
               "priority": 100,
               "formKey": "myForm.json",
               "parentTaskUrl": null,
               "executionUrl": null,
               "name": "Name one"
          }
     ],
     "start": 0
}
</code>

This was done with both an activiti:formKey in the xml and formKey through the task object.
So I'm a bit clueless as to what is happening there now.

b_schnarr
Champ in-the-making
Champ in-the-making
mmmh strange. Ok, I will try it with a newer version within the upcoming days. Actually, I temporally have a workaround by using the form service for each task.

b_schnarr
Champ in-the-making
Champ in-the-making
Even your new documentation states that the form key is not included when using GET runtime/tasks:

http://www.activiti.org/userguide/#_tasks_2

That would fit to my experience. Because I still can´t see any form key in the response…