User Task Due Date not working

Hi,

I’m editing a process via bpmn.io and tried to embed user tasks due date following the example in the documentation.

Example BPMN I have:

<bpmn2:userTask id="UserTask_0xpplm4" name="Test Task 003" camunda:dueDate="P1M">
      <bpmn2:incoming>SequenceFlow_1h1chwn</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_1oscwlt</bpmn2:outgoing>
</bpmn2:userTask> 

However once i deploy the process successfully the dueDate seems to be ignored and by looking at the task in cockpit i can see that no due date is set for the task once the process is started and task shows as pending.

Any idea why it is ignored?

A similar thing seems to happen for other camunda: extensions attributes passed in the BPMN file.
For example even if I manage to deploy a process that uses camunda:candidateUser or camunda:candidateGroup both seems to be ignored.

Any idea? perhaps I’m missing some setup / config for those extensions in the BPMN to be used ?

Hi @fredcallagan,

Which Camunda BPM version do you use?

Cheers,
Thorben

Hi,

I’m using camunda 7.3.

Sorry for the delay somehow did not notice any notification on your reply.

Sorry again. Please do let me know how to proceed.

Kind Regards

Hi Fredcallagan,
dueDate doesn’t accept time duration like timer
Only An expression which evaluates to a java.util.Date, java.util.String (ISO 8601 formatted) or null, e.g. ${dateVariable}

See below link
https://docs.camunda.org/manual/7.4/reference/bpmn20/custom-extensions/extension-attributes/#duedate

See dueDate example in below link (you can do the same)

http://docs.camunda.org/manual/7.4/user-guide/process-engine/expression-language/#internal-context-functions

The following example sets the due date of a user task to the date 3 days after the creation of the task.

<userTask id="theTask" name="Important task" camunda:dueDate="${dateTime().plusDays(3).toDate()}"/>

1 Like

Hi Hassang,

thank you for your reply.

I tried to follow your instructions and particularly this is a sample userTask in the bpmn xml file:

<bpmn2:userTask id="UserTask_0lkngpm" name="Test Task With Options" camunda:dueDate="${dateTime().plusDays(3).toDate()}"> <bpmn2:incoming>SequenceFlow_1j5h4w8</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0971hya</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1uzv2kj</bpmn2:outgoing> </bpmn2:userTask>

However once i start a process instance the above task still displays with a null dueDate as per json reply below:

{ "id": "52eb3273-27dd-11e6-a642-001c4237d912", "name": "Test Task With Options", "assignee": null, "created": "2016-06-01T09:43:41", "due": null, "followUp": null, "delegationState": null, "description": null, "executionId": "52eb0b5f-27dd-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "3983bf9b-27dd-11e6-a642-001c4237d912", "processInstanceId": "52eb0b5c-27dd-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lkngpm", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }

Any idea what could I be missing?

Kind regards

Hi Fredcallagan,

bpmn definitions generated by bpmn.io doesn’t have camunda namespace included (as it is generic editor)
That means you have to declare camunda namespace in your model
See below post
Using camunda extensions of BPMN model causing error during deployment

Hi Hasang,

thanks again.

The model had already the camunda namespace. However just to make sure I copied the namespace declaration from the link you posted and I’m sending attached the full BPMN xml file.

However same issue starting a process instance leaves the task with NULL due date:

{ "id": "3ecff65e-27e1-11e6-a642-001c4237d912", "name": "Test Task With Documentation", "assignee": null, "created": "2016-06-01T10:11:45", "due": null, "followUp": null, "delegationState": null, "description": "Test Documentation", "executionId": "3ecff65b-27e1-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "2e4f42e8-27e1-11e6-a642-001c4237d912", "processInstanceId": "3ecff659-27e1-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lyezex", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }

Below the attached BPMN file.

test-bpmn.bpmn (11.3 KB)

Kind Regards

Hi Fredcallagan,

camunda:candidateUsers should be used instead of camunda:candidateUser (letter [s] is missing)
<bpmn2:userTask id="UserTask_0lyezex" name="Test Task With Documentation" camunda:dueDate="${dateTime().plusDays(3).toDate()}" camunda:candidateUser="admin,1">

Also notice that you still have some tasks with invalid dueDate values
<bpmn2:userTask id="UserTask_05f2q82" name="Test Task 002" camunda:dueDate="P1M">
Try to remove or correct them

Hi Hassang,

sorry again.

Corrected the wrong dueDate as per attached BPMN file below:

test-bpmn.bpmn (11.3 KB)

Still same issue after process instance is started:

{ "id": "73ef1e9f-27ea-11e6-a642-001c4237d912", "name": "Test Task With Documentation", "assignee": null, "created": "2016-06-01T11:17:40", "due": null, "followUp": null, "delegationState": null, "description": "Test Documentation", "executionId": "73ef1e9c-27ea-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "5af33ed9-27ea-11e6-a642-001c4237d912", "processInstanceId": "73ef1e9a-27ea-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lyezex", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }, { "id": "73ef45b1-27ea-11e6-a642-001c4237d912", "name": "Test Task With Options", "assignee": null, "created": "2016-06-01T11:17:40", "due": null, "followUp": null, "delegationState": null, "description": null, "executionId": "73ef1e9d-27ea-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "5af33ed9-27ea-11e6-a642-001c4237d912", "processInstanceId": "73ef1e9a-27ea-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lkngpm", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }

Thanks for you time. Any idea what else could be wrong?

camunda:candidateUser should be camunda:candidateUsers

Hi Hassang fixed that as well but no luck.

{ "id": "a9b7c6db-27eb-11e6-a642-001c4237d912", "name": "Test Task With Documentation", "assignee": null, "created": "2016-06-01T11:26:19", "due": null, "followUp": null, "delegationState": null, "description": "Test Documentation", "executionId": "a9b7c6d8-27eb-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "8f1ed8e5-27eb-11e6-a642-001c4237d912", "processInstanceId": "a9b7c6d6-27eb-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lyezex", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }, { "id": "a9b7c6dd-27eb-11e6-a642-001c4237d912", "name": "Test Task With Options", "assignee": null, "created": "2016-06-01T11:26:19", "due": null, "followUp": null, "delegationState": null, "description": null, "executionId": "a9b7c6d9-27eb-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "8f1ed8e5-27eb-11e6-a642-001c4237d912", "processInstanceId": "a9b7c6d6-27eb-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lkngpm", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }

Attached bpmn:

test-bpmn.bpmn (11.3 KB)

dueDate will get a value after task creation.

Hi Hassang,

The response above of the 2 tasks came after starting the BPMN process instance from the definition attached which kick starts the 2 tasks above. In this case aren’t the 2 tasks above already created? Since they are showing by calling the end point rest below

/camunda-rest/task?processInstanceId=a9b7c6d6-27eb-11e6-a642-001c4237d912

Kind Regards

Hi,

I was able to reproduce your issue. Please use the activiti namespace xmlns:camunda="http://activiti.org/bpmn" for Camunda 7.3.0, then it will work.
From 7.3.3-ee and 7.4.0 on, the camunda namespace is supported, see CAM-4127.

The problem is your dueDate expression isn’t parsed with the wrong namespace.

Cheers,
Christian

1 Like

Hi Christian,

sure thank you again.

I’m testing basically the entire mechanics via REST API. Currently running Camunda 7.3.

  1. Deploying the process definition via rest end point: /camunda-rest/deployment/create this replies back with a confirmation of the deployed process. Response:

{ "links": [ { "method": "GET", "href": "http://diaku.local:8081/camunda-rest/deployment/0953ed23-27f3-11e6-a642-001c4237d912", "rel": "self" } ], "id": "0953ed23-27f3-11e6-a642-001c4237d912", "name": "test-auto-deployment", "deploymentTime": "2016-06-01T12:19:06" }

  1. I get the process definition id via the rest end point: /camunda-rest/process-definition?deploymentId=0953ed23-27f3-11e6-a642-001c4237d912

This gives me back the process definition details as per response below:

[ { "id": "09561005-27f3-11e6-a642-001c4237d912", "key": "changerequest-CatalogueItem-1-pool", "category": "http://camunda.org/examples", "description": null, "name": "Test Process Due Date 2", "version": 19, "resource": "test-bpmn.bpmn", "deploymentId": "0953ed23-27f3-11e6-a642-001c4237d912", "diagram": null, "suspended": false } ]

  1. Then start the process Instance for the above process definition via rest end point:

/camunda-rest/process-definition/09561005-27f3-11e6-a642-001c4237d912/start which replies with:

{ "links": [ { "method": "GET", "href": "http://diaku.local:8081/camunda-rest/process-instance/6d8927b6-27f3-11e6-a642-001c4237d912", "rel": "self" } ], "id": "6d8927b6-27f3-11e6-a642-001c4237d912", "definitionId": "09561005-27f3-11e6-a642-001c4237d912", "businessKey": null, "caseInstanceId": null, "ended": false, "suspended": false }

  1. Then i get the tasks generated by starting the process via the end point:

/camunda-rest/task?processInstanceId=6d8927b6-27f3-11e6-a642-001c4237d912

which replies with tasks:

{ "id": "6d8927bb-27f3-11e6-a642-001c4237d912", "name": "Test Task With Documentation", "assignee": null, "created": "2016-06-01T12:21:54", "due": null, "followUp": null, "delegationState": null, "description": "Test Documentation", "executionId": "6d8927b8-27f3-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "09561005-27f3-11e6-a642-001c4237d912", "processInstanceId": "6d8927b6-27f3-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lyezex", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }, { "id": "6d8927bd-27f3-11e6-a642-001c4237d912", "name": "Test Task With Options", "assignee": null, "created": "2016-06-01T12:21:54", "due": null, "followUp": null, "delegationState": null, "description": null, "executionId": "6d8927b9-27f3-11e6-a642-001c4237d912", "owner": null, "parentTaskId": null, "priority": 50, "processDefinitionId": "09561005-27f3-11e6-a642-001c4237d912", "processInstanceId": "6d8927b6-27f3-11e6-a642-001c4237d912", "taskDefinitionKey": "UserTask_0lkngpm", "caseExecutionId": null, "caseInstanceId": null, "caseDefinitionId": null, "suspended": false, "formKey": null }

By the way thanks for you last reply.

Just posted my reply in case might help others on process deployment and starting etc.

Kind Regards and thank you again

Thank you

very much appreciated that works perfectly!

Thank you very much.

with this code we can add only default due date i.e after 3 days from its creation, but i want to set different date for different task then which code i should write?

Hi @kavyansha

You can use any expression which evaluates to a java.util.Date, java.util.String (ISO 8601 formatted) or null, e.g. ${dateVariable}

May we know your use case…

so for every user i have to modify the expression for date as per the requirement?