Script runner : get a Simple Selection List value

Christophe Leite September 17, 2013

How to get the value of simple selection list component ?

For example, I have a list list1 with 3 values 'value1', 'value2' and 'value3'

cfValue['list1'].value=='value1' does not work ... :-(

Any solution ?

Thanks a lot,

Christophe

6 answers

1 accepted

1 vote
Answer accepted
RambanamP
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 17, 2013

can you try this

cfValue['list1']=='value1'

as per mahela comment on following post, it worked for him

https://answers.atlassian.com/questions/205719/need-help-to-setcustomfieldvalue-for-a-select-list-type?page=1#comment-211675

1 vote
Bharadwaj Jannu
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 17, 2013
0 votes
Christophe Leite September 25, 2013

Yes... may be an improvement to suggest at Atlassian's development teams...

I work on JIRA 5.2.11 .. may be lastests versions of JIRA are OK with that

0 votes
Christophe Leite September 19, 2013

I've found : there was a space behind list1 ... I don't believe that JIRA keeps this caracter and don't truncate the name of custom field without this space caracter.

So, to resume, when we try to get some values from custom fields, we have to care about its name : because it's case-sensitive and JIRA don't take off the space caracter you could have at the end of your custom field's name ...

JamieA
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 19, 2013

Yeah, that's a frickin pain. It's the same for workflows. IMHO jira should trim these before it stores them.

0 votes
Christophe Leite September 19, 2013

Yes, it's the really name of my field. I've tried with all the possiblities :

cfValue['list1'].value=='value1'

cfValues['list1']*.value.contains("value1")

It does not work :-(

JamieA
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 19, 2013

See https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-PowerAssertions

Show us the output when you do assert the above in condition tester.

0 votes
Christophe Leite September 17, 2013

It does not work for me... :-(

JamieA
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 17, 2013

See See https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-PowerAssertions

Is "list1" really the name of your custom field? It's case-sensitive.

JamieA
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 17, 2013

Also please try to avoid creating duplicate posts when people are already trying to help you on your other question.

Suggest an answer

Log in or Sign up to answer