Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

i need to populate a customfield which is user picker from scripted field

So what i am basically trying to do is create a scripted field and write certain condition in that scripted field and when certain event for example edit happen on the issue this script runs and then it will allow the user based on the condition in the scripted field to send this value "the user " into the user picker . so now i want to be able to populate the user picker custom field from the scripted field with the user value when ever the condition is true .

Hope i didnt confuse .

1 answer

0 votes

This is not quite what "Scripted field" means in Scriptrunner.  In SR, a scripted field is static data that is calculated and displayed, it's not setting a field.  Scripted fields are their own type of field, they're not "user pickers", "text", "date" etc.

So, there's three parts to the script you need to put together, which I'll extract from your question:

>when certain event for example edit

That tells us you need a scripted listener - this can catch an event and run a script if appropriate.  Sample listener code here:

>allow the user based on the condition

I can't help much with that, you've not defined the condition, but it should not be too hard to script - it's probably going to be nothing more complex than the listener code with "If {condition} then {change data in user picker}"

>populate a user picker

There's a generic script for setting all the custom field types at  - just take all the "user picker" related lines from that.

Thank you for the reply @Nic Brough _Adaptavist_  . So basically we have behaviour in the Script runner to restrict certain action . which is not working in my case when the jira instance is being used from the mobile application , so i thought about writing a scripted field which captures the event of edit , get the operating system info and  if (operating system =android ) it should be null and if it gets through the condition it should populate the user picker with the current user in the custom field which is used in the permission scheme of the project so he is able to edit .

so is the above scenario possible ? as i have been looking for something which will help me out but couldn't find anything until now  .

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events