Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to automatically assign an issue right when it is created?

Emil Khairov April 12, 2023

Hello,

 

I am trying to set an assignee right at the "Create" Transition of an issue. 

I've tried traditional post-functions in the workflow, as well as ScriptRunner features. However, I am unable to reach my goal.

I am able to update the Summary field at the "Create" transition but non of my attempts work for the Assignee field.

3 answers

1 accepted

4 votes
Answer accepted
Emil Khairov April 12, 2023

I've actually managed to do this.

The issue was in the way I was trying to access the assignee field. Apparently, it goes deeper and looks similar to this:

assignee{

...

accountId: "someID"

...

}

So, I had to use the following script of the ScriptRunner to achieve my goal:

def issueKey = issue.key
def newAssignee = 'Insert User ID here' // it is important to insert user ID.

def result = put("/rest/api/2/issue/${issueKey}")
        .header('Content-Type', 'application/json')
        .body([
                fields: [
                        assignee: [accountId: newAssignee
                        ],
                ]
        ])
        .asString()
4 votes
Mayur Jadhav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2023

Hello @Emil Khairov ,

I hope you are doing well!!

You can use automation rule in order to assign the issue automatically at the time of issue creation.

You may please have a look at https://www.atlassian.com/software/jira/automation-template-library/auto-assign 

and 

For more information how to configure and how it works you can have a look at YouTube video - https://youtu.be/_BZeN8VO2fA 

 

Regards,
Mayur

Emil Khairov April 12, 2023

Hello @Mayur Jadhav , 

I am trying not to go heavy on automation and broaden my knowledge in deeper aspects of workflow and generally, Jira management. 

However, thank you for the suggestion, I appreciate it!

Like Mayur Jadhav likes this
1 vote
Dan Breyen
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.
April 13, 2023

Another option is if you use Components, you can assign someone to each component and when that component is selected, they can be assigned to the issue when it's created.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events