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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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

Can you help me set approvers basis two custom fields in jira?


At the time of issue creation if a category (single select custom field) has a value selected 'xxx' then the issue must go to ND approval. ND approvers are different for different countries. Let say country (multi select custom field) is selected as 'yyy' then approver is the user 'abc' and if the country selected is 'zzz' then the approver is the user 'efg' etc. There is a list for this.

I want write a custom script for this and set it as Post function on that respective transition. 

Please help me fix this.

1 answer

1 accepted

1 vote
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 11, 2021

That's possible, but you'll have to keep your country/user association right in the script.


Something like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption

def countryUserMap = [
def categoryCf =ComponentAccessor.customFieldManager.getCustomFieldObjectsByName('Category').first()
def countryCf = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName('Country').first()
def category =(issue.getCustomFieldValue(categoryCf) as LasyLoadedOption).value
def country = (issue.getCustomFieldValue(countryCf) as LasyLoadedOption).value
if(category == 'xxx){
def assignee = ComponentAccessor.userManager.getUserByName(countryUserMap[country])
issue.assignee = assignee

Hey Peter,

Will try this , thanks.

Hi Peter,

Thanks for solution, that really worked for me.

Thank you.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events