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

This widget could not be displayed.

Using which add-on? ScriptRunner? JMWE? 

Using Script Runner.

This widget could not be displayed.

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 Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

428 views 3 17
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