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

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

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

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

Hi Jordan, 

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

Thanks,

Katy

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

64 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you