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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Multi-user picker field is not populated by behavior script

I'm using script runner behavior version 6.2.1 to populate value on my jira service  desk customer portal screen.

Below is the code that I use to set the multi-user picker custom field:

def appManagerField = getFieldByName("Application Manager(s)")

appManagerField.setFormValue(['user1']);

This piece of code is triggered because, when I print the log, I can see the value in the log file.

However, the custom field is not populated with the value that I want (user1 in this case).

Anyone could give advise on this please?

 

2 answers

When I use behavior, I usually face an issue when getting field by name. It sometime doesnt work, so to verify, I usually trigger 

getFieldByName("Application Manager(s)").setHelpText("Hello")

If the word hello appear,  that means you reference the correct form field 

--

Recently I had a similar requirement and I achieved it with the exact type that you are providing.

You may also try one of these because sometimes one of them only work

appManagerField.setFormValue(['user1']);
//or
appManagerField.setValue(['user1']);

Hi Najjar,

 

Thank you for your reply!

The below code is working fine. So, getting the field is not the issue for us.

getFieldByName("Application Manager(s)").setHelpText("Hello")

 However, setting the field value seems to be remain problem. Both code below are not working. I really don't know why.

appManagerField.setFormValue(['user1']);
//or
appManagerField.setValue(['user1']);

Somebody help pls. 

Try this

appManagerField.setValue('user1')

If you want to add multiple:

appManagerField.setValue('user1,user2, user3')

Hi Najjar,

 

I've try what you suggesterd. If i use  method 'setValue', I will hit compilation error 'Cannot find matching method....' 

 

I now suspect that this problem is caused by some other plugin that I use.

Sorry I meant to write

appManagerField.setFromValue('user1,user2, user3') 

Yup, I've tried appManagerField.setFromValue('user1,user2, user3')  as well. Still not working.

 

Here is the error I see from the browser console log

6.PNG

Previously, my code was working fine. Until, recently, my colleague did Jira version upgrade. So, I suspect it might due to some other plugin that cause this error?

This only happen to user picker field.

 

For text field, I can set the value successfully using behavior.

Suggest an answer

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

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

227 views 1 6
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