Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

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: 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.

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
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

280 views 8 7
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