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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,556,422
Community Members
 
Community Events
184
Community Groups

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

acc1211
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2021

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2021

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: https://library.adaptavist.com/entity/update-the-value-of-a-custom-field-using-a-listener

>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 https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console  - just take all the "user picker" related lines from that.

acc1211
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2021 • edited May 23, 2021

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
TAGS
AUG Leaders

Atlassian Community Events