Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to automatically assign a user to a subtask

How do I automatically assign a user to an existing subtask?

1 comment

Hi @Angela DiCesare

By default, your sub tasks will be assigned to the component lead. If one of your sub tasks should go to a different user, you can hard code this change in the post function.

NOTE: This solution utilizes script runner add-on to hard code the assignee to the sub task.

  1. Go to your project
  2. Click Project Settings
  3. Click Workflow
  4. Edit your workflow
  5. Choose diagram
  6. Click the first transition (create), then click Post Functions
  7. Click Script Post-Funciton [ScriptRunner]
  8. Create sub task
  9. Condition = the script for identifying the component:

    import com.atlassian.jira.bc.project.component.ProjectComponent
    import com.atlassian.jira.component.ComponentAccessor

    for(ProjectComponent projectComponent: issue.getComponentObjects()){
    if(projectComponent.getName().equals("COMPONENT NAME"))
    return true
    return false

  10. Target Issue Type = Sub-task
  11. Sub Task Summary = What the sub task will be called
  12. Additional issue actions field:

    issue.assigneeId = "TYPE USER NAME HERE"

  13. Click Update
  14. Publish the workflow changes

Hope this helps or at least gets you past 1 hurdle!

- Jonathan

Like # people like this

Hi, I would like to do the same automatic assignment but I can't find the "Additional issue action" field on the "Post function" list.

Can you give me any suggestions?



@Carlo Anapoli 

   I updated the response above.

My setup is to generate a sub task based on selection of a component. The sub task will then auto assign to whoever we hard code in step 12.

It is messy but it works.

- Jonathan

Like Carlo Anapoli likes this


Log in or Sign up to comment

Atlassian Community Events