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
4,362,245
Community Members
 
Community Events
168
Community Groups

Scriptrunner behaviour for limiting assignee list

Deleted user Jun 06, 2019

Hello everyone

This has been asked quite a lot already but I was unable to find an appropriate solution for our use case.

I really only need a behaviour which will run on all projects on all issuetypes and on every screen.

This behaviour should remove some options from the assignee field.

We cannot do this with the assignable user permission as these users should be able to be assignees but just not at every point and we would like to prevent our users from manually selecting them.

I also found the option of using a workflow validator but then again, after creation of the issue, the user could just edit the issue and then re-assign it which is why a behaviour would work best.

Can anyone help us out here on where to begin with this?

Thanks!

1 answer

0 votes

I don't think scriptrunner behavior setFieldOptions() method can run on the assignee (or any user fields) to limit the available list.

At best, you can react to change in the assignee field and validate the value with the behavior and use the setError() method to stop users from saving while an invalid user is selected.

def okList = ['user1','user2']
def fld = getFieldById(getFieldChanged())
if(fld.value in okList){
fld.clearError()
} else {
fld.setError("Not a valid assignee. Pick from $okList")
}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events