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 vote

Using which add-on? ScriptRunner? JMWE? 

Using Script Runner.

0 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

361 views 0 6
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