Set assignee based on a custom field value

I have installed scriptrunner as I believe it is necessary for me to set the Assignee based on a customfield value. If custom field, Value, is set to 1, I want to assign john.smith. If custom field, Value, is set to 2, i want to assign betty.williams, etc.

I looked at this answer https://answers.atlassian.com/questions/140304/groovy-post-script-to-assign-a-user-based-on-a-customfield

And am trying to interpret to know what I need to replace in terms of the custom field, custom field value, and assigee. Please bear with me as I haven't done coding in almost 10 years!

Is the reference to CustomField the ID or the field name? I would assume ID since that is unique, but it's not clear. Same with value - I would think I would put in the actual value name as I don't recall seeing the ID in the URL. For assignee, I'm confused as to what to replace.

Appreciate any ideas/assistance.

1 answer

1 accepted

0 vote
Tarun Sapra Community Champion Feb 26, 2014

My advice - always refer cutom fields by IDs and this worked for me in one of my scripts -

customFieldManager.getCustomFieldObject("customfield_11550");

So if you go to the link you have shared you can use the ID of custom field and you can know the ID of any custom field by going to it's edit screen and the ID wouuld be part of the URL.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

221 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you