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")
}
Is this code on an Initialiser or specific field?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.