Set the due date of an issue to the maximum due date of its sub-tasks.

This article provides the code snippet to set the due date of an issue to the maximum due date of its sub-tasks using JMWE post-function.

 Instructions

  1. Navigate to the intended workflow of the parent issue and open it in Edit mode.

  2. Select the required transition.

  3. Select the Post functions tab and click Add post function.

  4. Add the post-function.

  5. Select “Current issue” under “Target Issue(s)”.

  6. Select the “Due date” field and add the below Nunjucks template:

    {{ issue | subtasks("duedate") | filter(["fields.duedate",null],true) | field("fields.duedate") | sort(true) | first }}

    The above script sorts the Due date of the current issue’s sub-tasks in descending order (high to low) and returns the highest Due date value.

    Set Issue Fields JMWE post-function
  7. Publish the workflow for the changes to be applied as configured and select a backup copy before publishing the new changes.

When the transition with the above post-function is executed on a parent ticket, the Due date value of this parent will be set to the highest Due date of its sub-tasks.

 

References