Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I dynamically re-assign the Assignee field based on Issue Type?

Jordan Klein February 6, 2018

I'd like to dynamically set the default form value of the Assignee field based on the user's Issue Type selection. After looking at comparable questions, I've arrived at this code, but the Assignee field is not changing dynamically.

Note that Assignee is not set as a required field. My intention is that it should default to the values specified based on Issue Type, but the user should still be able to edit it (otherwise I would use a post-function).

Any help is appreciated!

 

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.atlassian.jira.issue.IssueFieldConstants.*
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours

def issueTypeId = getFieldById(getFieldChanged()).getValue() as String
def issueTypeName = ComponentAccessor.getConstantsManager().getIssueType(issueTypeId).name

if (issueTypeName == "Game Bug") {
getFieldById(ASSIGNEE).setFormValue("Unconfirmed")

}

else {
getFieldById(ASSIGNEE).setFormValue("-1")
}

 

1 answer

0 votes
Kyle Moseley
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 8, 2018

Is this code on an Initialiser or specific field?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events