Scriptrunner: Condition with custom field value

Christian Sander April 3, 2018

Hey,

i got a state of an Issue which has two outgoing transitions (Transition A & Transition B). Regarding the value of a custom field (Type: number field) I want either Transition A or Transition B shown if the value is 50 or smaller. My try was using Scriptrunners Simple scripted condition:

 

cfValues['custom field'].values <= '50'

 

 

1 answer

1 accepted

0 votes
Answer accepted
Charly [DEISER]
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.
April 3, 2018

Hi @Christian Sander

Can you try with this:

cfValues['custom field'] <= 50

Regards 

Christian Sander April 3, 2018

Hi Carlos,

 

thanks for the fast reply. I've changed the code as you suggested and got the following error:

[Static type checking] - Cannot find matching method java.lang.Object#compareTo(int). Please check if the declared type is right and if the method exists. @ line 1, column 1.


Probably got a problem with the data type?

Charly [DEISER]
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.
April 3, 2018

test.png

 

Hi @Christian Sander

Yes, can you check the value in the custom field? You can also test (preview) the script when configuring the condition to validate it.

Cheers

Christian Sander April 3, 2018

Hi Carlos,

Thank you for the tips. It's working fine.

Cheers Christian

Karl Samson April 24, 2024

Hi Guys, just in case you are dealing with a Cascading custom field. I found the below to work nicely!

cfValues['Custom Field']?.get(null)?.value == 'value'

Suggest an answer

Log in or Sign up to answer