Get cascading select value

SaidAslan October 16, 2016

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

1 vote
Answer accepted
SaidAslan October 17, 2016

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

Atlassian Community Events