How to automatically assign a user to a subtask

Angela DiCesare February 7, 2019

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

5 answers

2 votes
Jonathan Smith
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2019

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

Jorge.Sigala@bmo.com January 16, 2024

on Step 6, I cannot see "Post Functions" when I click the first transition (create), or in fact any transitions, and actually I cannot see anything popping up when hoving over or right-clicking on them. It could be any permissions constraints?

1 vote
Jonathan Smith
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2019

@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

0 votes
Jonathan Smith
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2024

The new answer now is utilize Jira Automation.

0 votes
Carlo Anapoli September 24, 2019

Ok, thanks!

0 votes
Carlo Anapoli September 20, 2019

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?

 

Thanks

Suggest an answer

Log in or Sign up to answer