How to Get Custom field (Dropdownl list ) selected value?

Nikhil Rote September 25, 2017

Hi,

 

    We have written one dropdown list name['EMployee']. In Employee Field there are 4 employee name ex{john, mark, sham, george}. Suppose we select 'mark' in dropdownlist. Then how should i get value of this field using groovy script?. We need 'mark' string value.
         Can any one help us. we are using 7.3.0 jira version. Thanks in advance.

2 answers

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 27, 2017

Depends on where you're running the code, but assuming it's a post-function which provides "current issue" for immediate use, then

def myCf = customFieldManager.getCustomFieldObjectByName("EMployee")

def cfValue = issue.getCustomFieldValue ( customField )

And then, as you will have had options returned, cfValue.getName() for it as a string.

Nikhil Rote September 27, 2017

Hi Nic Brough,

          Yes we are using Post function.  we have tried 'cfValue.getName()' but it is showing error.

Attached screenshot please check and let me know where is the mistake in my code.

 

 

 

 

jira.png

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2017

Using which add-on? ScriptRunner? JMWE? 

Nikhil Rote September 25, 2017

Using Script Runner.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events