Retrieve a radio button value

Hello,

I've got a field named "Asked" with 2 possible answers (Yes or No) in my issue.

In my workflow, I would like to retrieve the field value.

How can I do that ? I've tried
cfValues['Asked'].getValue() == 'Yes' but that doesn't work... :-(

Thanks,

Christophe

2 answers

1 accepted

This widget could not be displayed.

the following code i have usedto get radio button value

CustomFieldManager cfm = ComponentManager.getCustomFieldManager()
CustomField asked = cfm.getCustomFieldObjectByName("Asked")
Option option=(Option)issue.getCustomFieldValue(asked);
if (option.getValue().equals("Yes")) {
// remaining code here
}

if you are doing it by Behaviour plugin then try with this code

FormField asked = getFieldByName ("Asked")
String value = asked.getValue()
if (value == "Yes") {
// remaining code here
}

check this document to get some sample codes

https://jamieechlin.atlassian.net/wiki/display/JBHV/Miscellaneous+Behaviours+Examples

So, in my case, should it be cfValues['Asked'].option.getValue().equals("Yes") ?

something like this

cfValues['Asked'].getValue().equals("Yes")

can you check what value it will return the following code

cfValues['Asked'].getValue()

i have update my answer try with that code it should work!!

This widget could not be displayed.

How can I display tis value in a message box ?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

130 views 2 0
Join discussion

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