How can I set the FormValue of Assignee to "Automatic"

Jordan Klein January 16, 2018

On the Create Issue screen, I'm using an Initializer function to dynamically change the default FormValue of Assignee based on Issue Type.

This is working fine when I use actual users, but I'm unable to set the FormValue of Assignee back to the "Automatic" option (which has a value of -1)

This works:

getFieldById(ASSIGNEE).setFormValue("bobparker")

This doesn't work:

getFieldById(ASSIGNEE).setFormValue("-1")

 

Full code is below:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return
}

getFieldById(ASSIGNEE).setFormValue("-1")

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer 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 19, 2018

Hi Jordan.

I had a few problems with behaviours myself in old versions. Since I'm a dev at the Scriptrunner team I have access to all of its builds. In the new development build it works fine. I would tell you to wait it out. It will work once you update.

If this helped out, please accept answers, so that users know this question has been answered.

Cheers!

DYelamos

Jordan Klein January 19, 2018

Hi Daniel,

To clarify, I'm on the latest (Version 5.2.2). You're saying wait till the next SR release for this functionality?

Thanks!

Jordan

Katy Kelly
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 24, 2018

Hi Jordan, 

That is correct. Please click Watch on the version history page to be notified once released. 

Thanks,

Katy

TAGS
AUG Leaders

Atlassian Community Events