Get cascading select value

Hi, 

I have a script-post-function on some transition and need to get value (1 level) from the cascading select list,  and, depending on the value assign issue to some user. 

Could you please help with this? 

 

I've tried to compare like 

if (cfValues['Custom Field']?.get(null) == 'val1')
{
 issue.setAssigneeId('user 1') 
}

but as I understood this method works only in validators. 

 

2 answers

1 accepted

ok, for JIRA 7 the following works: 

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField cf = customFieldManager.getCustomFieldObjectByName("Custom Field")
Map cfVal = issue.getCustomFieldValue(cf) as Map
String value = cfVal.get(null)

if (first == 'val1')
{
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName("user 1"))
}

Thanks 

1 vote
Vasiliy Zverev Community Champion Oct 17, 2016

I would reccomend to use 

issue.setAssignee(ComponentAccessor.getUserManager().getUserByName("user 1"))

imstead issue.setAssigneeId('user 1')

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

172 views 0 4
Read article

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