Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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-
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.
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 Champion
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