Regarding the configuration of the UserTask due date

I need to set a dueDate for the UserTask of the process model. I want to set this time to 24 hours after the task is successfully created. How should I configure it?

Does the process engine provide a method to retrieve the creation time of a UserTask?

Hi there! :wave:

Great question about configuring UserTask due dates! I can help you with both parts of your question.

Setting Due Date to 24 Hours After Task Creation

You can configure a UserTask’s due date to be 24 hours after its creation using the zeebe:taskSchedule extension element in your BPMN model. Here’s how:

In your BPMN XML:

<bpmn:userTask id="myUserTask" name="My User Task">
  <bpmn:extensionElements>
    <zeebe:taskSchedule dueDate="= now() + duration('P1D')" />
    <zeebe:userTask />
  </bpmn:extensionElements>
</bpmn:userTask>

In Camunda Modeler:

  1. Select your UserTask
  2. In the Properties Panel, find the “Due date” field under the scheduling section
  3. Enter the expression: = now() + duration('P1D')

How it works:

  • now() returns the current date and time when the user task is activated (creation time)
  • duration('P1D') represents 1 day (24 hours) in ISO 8601 duration format
  • The expression calculates the due date as exactly 24 hours after task creation

Retrieving UserTask Creation Time

Yes, the process engine does provide methods to retrieve the creation time of a UserTask through the Tasklist API:

REST API:

GET /v1/tasks/{taskId}

The response includes a creationDate field:

{
  "id": "string",
  "name": "string", 
  "creationDate": "2023-03-29T20:08:07.171Z",
  ...
}

GraphQL API:

{
  task(id: "your-task-id") {
    id
    creationTime
    ...
  }
}

References

This approach ensures your due date is always calculated relative to the actual creation time of the user task. Let me know if you need any clarification!

Perfect! I’m glad I could help you configure UserTask due dates in Camunda 8.

Summary of the solution:

  • Use zeebe:taskSchedule with the expression = now() + duration('P1D') to set due dates 24 hours after task creation
  • Retrieve task creation time via Tasklist API using creationDate (REST) or creationTime (GraphQL) fields
  • Configure this easily in Camunda Modeler’s Properties Panel or directly in BPMN XML

The now() function ensures the due date is always calculated from the actual task creation time, giving you the precise 24-hour window you need.

Happy modeling! :rocket: