How can I set one or more users to the Approvers field with a ScriptRunner behaviour?
I tried setFormValue("user1") but it did not work. Here is the code.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def approversField = customFieldManager.getCustomFieldObjectByName("Approvers")
approversField.setFormValue(["user1"])
Hello @mmr1909
To set value on the form via behaviour, you need to get FormField object like this:
def approversField = getFieldByName("Approvers")
approversField.setFormValue(["user1"])
Hello @Mark Markov,
now it works! Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @mmr1909
You're welcome! If it helps you, please mark answer as accepted :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark
Would you be able to show me a simple script to pull the users into the field based on security group?
Preferably with an if statement based on another field. If custom field application type = x then pre fill approvers field with members of X application approvers group.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.