Can Scriptrunner limit the Assignee list based on another field when creating an issue?

Johannes Buverud
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.
January 25, 2018

When creating an issue, our users has to select what team should be assigned the issue. (The teams field will either be a listing of jira groups or an Insight custom field refeering to a list of teams in the Insight plugin. We have not decided yet on this).

Based on what team is selected, we would like the choises of users in the default Assignee field to be narrowed down to only those poeple belonging to that team.

(I know we can do something similar by duplicating all users into Insight, linking those to the teams, and then use an Insight custom field on the Create form to display the limited list of Insight users, but that is not a good solution for us.)

Is there a way to use Scriptrunner (or something else) to do this?

1 answer

1 vote
Daniel Yelamos [Adaptavist]
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.
January 29, 2018

Hi Johannes.

Yes, you can do this via custom validators.

You would use a custom validator onCreate transition to make sure that the assignees are in a group of names of your choosing.

Do you understand what I mean, or would you need help actually coding this?

However, mind you, we at Scriptrunner do not officially support interaction with Insight, and I couldn't help you code that part. 

Johannes Buverud
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.
January 29, 2018

Thanks for your answer, Daniel,

What we need is to present the limited list of possible assignees to the user, based on the prevoius choise.

Would this validator do this, or would it merely give an error if one selects an assignee which is not "accepted"?

Daniel Yelamos [Adaptavist]
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.
January 29, 2018

Ah. This is a bit more complicated then. No, validators would not work. 

You would need to use behaviours. There are a few guides in our documentation regarding limiting and restricting options from multi-selects and single selects.

You can check out these guides here

I would use one of them to base myself upon and build the script that you require.

May I help you further?

Cheers!

Dyelamos

Johannes Buverud
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.
January 29, 2018

Thanks again,

When I look at how behaviours work, it looks like the options presented to the user is picked from a list allready loaded into the browser on the client side. We have about 1000 assignees to pick from, so if my understanding is correct this would probably present a perfromance issue.

Am I maybe misunderstanding? Could you maybe provide me with an example on how this would be implemented?

Daniel Yelamos [Adaptavist]
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.
January 29, 2018

Yes, that could be a performance issue. 

I'm actually not very sure how to do this for very big instances.. I've only been working on the development team for SR for a year, so I'm not a master yet. 

In that case, I would really just use validators. It will prove a pain for some users, specially if you don't have a way to easily identify the users...

I'll ask around my team to see if someone has a better approach to this. Let me get back to you tomorrow. 

Cheers!

Dyelamos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events