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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published Monday in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

492 views 8 9
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