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

1 votes

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 Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

651 views 4 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot