Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set User Picker in Jira Service Desk with ScriptRunner Behaviour

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")




2 answers

1 accepted

0 votes
Answer accepted

Hello @Michael Müller

To set value on the form via behaviour, you need to get FormField object like this:

def approversField = getFieldByName("Approvers")


Hello @Mark Markov,

now it works! Thanks for your help.

Hello @Michael Müller

You're welcome! If it helps you, please mark answer as accepted :)

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.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Desk

The Complete Guide to Atlassian for ITSM

Hi Atlassian Community! This is Teresa from the Atlassian team. My colleague Paul Buffington @Buff and I are excited to share a brand new ITSM resource we’ve created – "The Complete Guide to At...

2,186 views 15 22
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you