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

Multi-user picker field is not populated by behavior script

Joe Bkk July 27, 2020

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

0 votes
Joe Bkk July 29, 2020

This only happen to user picker field.

 

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

0 votes
Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 28, 2020

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']);

Joe Bkk July 28, 2020

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. 

Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 28, 2020

Try this

appManagerField.setValue('user1')

If you want to add multiple:

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

Joe Bkk July 29, 2020

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.

Najjar _Innovura_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 29, 2020

Sorry I meant to write

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

Joe Bkk July 29, 2020

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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events