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?
This only happen to user picker field.
For text field, I can set the value successfully using behavior.
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']);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
appManagerField.setValue('user1')
If you want to add multiple:
appManagerField.setValue('user1,user2, user3')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I meant to write
appManagerField.setFromValue('user1,user2, user3')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.