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

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

Using which add-on? ScriptRunner? JMWE? 

Using Script Runner.

0 votes

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.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

300 views 0 1
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