Create a Sub-task

The Create a sub-task post function creates a sub-task after an issue has been transitioned. For example, you have an issue type that requires approval from three different departments. You could use this post function multiple times to automatically create three sub-tasks, one for each approval, whenever an issue is moved through an Approval Required transition (or equivalent). If you want to further automate your workflow, you could also use the Transition Parent when all Sub-tasks are Resolved post function. 

Subtask action

If a parent issue already has a matching sub-task, you can use the Subtask Action option to update the action of the matching sub-task rather than creating a new sub-task. For example, a department must approve the parent issue and the sub-task represents their approval. The department rejects the approval. They move the parent issue back a step in the workflow so more work can be done, and move the sub-task to Done. When the parent issue is ready for approval again and moved through the approval transition, instead of making a new sub-task for this department to complete, the sub-task previously marked as Done (or equivalent) is reopened. 

If the Subtask Action is left blank a new sub-task is created every time the parent issue is moved through the selected transition.

Use this post function

  1. Go to Administration > Issues > Workflows.
  2. Select Edit on the workflow you want to add this post function to. 
  3. Select the transition you want to add this post function to.
  4. Under Options, select Post Functions.

  5. On the Transition page, select Add post function.
  6. Select Create a sub-task.

  7. Select Add.
  8. Optional: Enter a note that describes the post function (this note is for your reference when viewing all post functions).
  9. Optional: Enter a condition. 
  10. Select a target issue type.
  11. Optional: enter a sub-task summary. Leave this option blank if you want the sub-task to inherit the summary from the parent task. 
  12. Choose which fields you want to copy to the sub-task—All, None, or Custom
  13. Enter a user you want this post function to run as. Leave this option blank if you want this post function to run as the current logged in user performing the transition.
  14. Optional: Enter any additional actions you want to occur.

    To disable or selectively copy links, use the same method as described in the Clones an Issue and Links documentation.

  15. Optional: Set a sub-task action. If a matching sub-task already exists, this is the transition you want to move it through. Leave this option blank if you want to create a new sub-task every time the parent issue is moved through the selected transition.
  16. Select Preview to see an overview of the change.
  17. Select Add.

  18. If applicable, reorder your new post functions using the arrow icons on the right of the function (they can only move one line at a time).

    This post-function should be placed after the Re-index an issue to keep indexes in sync with the database post function. If you don’t do this, the parent issue will not be indexed correctly. Check out our documentation on Post function order for more information.

  19. Select Publish and choose if you want to save a backup copy of the workflow.

    Test your post function

    You can now test to see if this post function works.



Related content

On this page