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

How to change Assignee based on Components - but only if it was left blank - on Create screen?

Simonas Tvirbutas November 4, 2013

Hi,

I've been tackling this problem for a while now and feel like I'm stuck, so any help would be greatly appreciated.

I want to setup JIRA to apply custom logic (based on Components selected) when auto-assigning new tickets if the user selected more than one Component.

What I've tried so far:

1. Write a post function - seemed like a great idea until I found out that by the time I get access to the Issue object the Assignee is already set, and there is no way for me to determine whether Assignee was set explicitly or not.

2. Then I decided to cheat the system and write a Validator instead - but encountered the same problem - default auto-assignee funtionality is executed before the Validator has access to the issue.

I think the only other thing I can try at this point is a plugin that lets me run scripts (I've read a bit about JSS and ScriptRunner), but I have no idea where to start with those.

Can anyone point me in the right direction?

Ideal solution would be if the Assignee field would update dynamically as you change Components in the Create Issue screen.

Second best would be if it ran as you click the Create button (so I can check if Assignee was set explicitly before doing anything).

Thanks for your help!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Simonas Tvirbutas November 7, 2013

OK, found a solution here: https://answers.atlassian.com/questions/89722/determine-if-automatic-was-choosen-for-assignee-within-workflow-validator

Apparently you can access the HTTP request when executing a post function, including what was in the Assignee field when the Create button was pressed. Thus I came back to my Workflow Post Function plugin, added this check there and got exactly what I needed!

Renjith Pillai
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.
November 9, 2013

That's a good one.

0 votes
Renjith Pillai
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.
November 5, 2013

Isn't that already handled by JIRA?

  • If the assignee is left as Unassigned it remains Unassigned
  • If the assignee is selected as 'Automatic', it goes to the first Component owner (provided that was set in the Component properties)
  • If the assignee was selected as a specific user, it remains as that user.

So you need to handle only if the user didn't select any assignee. So in the post function, if the assignee is empty, you can do your logic to assign to whoever you need to.

Is that what you looking for or did I get your question wrong?

Simonas Tvirbutas November 5, 2013

This only works when a single Component is selected. If the user selects more than one Component, JIRA selects the one that is first alphabetically and sets that Component's lead as the assignee. That's the case that I need to handle.

Renjith Pillai
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.
November 6, 2013

So in that case dump the JIRA functionality of automatically assigning using Component leads. If you do that, then if the assignee has a value, it has to be what the user has selected. If not, do your logic in the script.

Simonas Tvirbutas November 6, 2013

Wouldn't that mean that I would have to allow unassigned issues in Jira options? Which would in turn mean that that I would have to add validators for all edit actions to prevent people from manually removing the assignee? I don't think Jira even supports Validators on Edit action without overriding parts of the system.

Renjith Pillai
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.
November 7, 2013

Yes (i was assuming it was the case).

Edit is not an issue, just remove the assignee field from the edit screen.

ChrisR October 20, 2015

So you can have a development lead a project lead as well as a QA lead, this way when the work flow passes from development to test the user assigned to that component can be automatically assigned as well. any thoughts?

TAGS
AUG Leaders

Atlassian Community Events