Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner - Fast-Track transition based on number Custom Field

Jonathan V.
Contributor
April 17, 2020

Hi all,

I have googled my eyes out and I have been unable to find a successful answer to this issue I am having, so I'm hoping someone here can help.

I have a custom field for a Dollar Amount, and depending on the amount we fast-track and bypass an approval.

I have tried different ways of validating this criteria and none work. See the 4 methods I have tried ( 2 of which were answers I found online).

 

1) cfValues["Amount"] <= 20000

2) cfValues["Amount"] <= 20000.0

3) cfValues["Amount"] <= Double.valueOf(20000)

4) def amount = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjects(issue).find{it.name == "USMIA - USD Amount"})

amount <= 20000

 

Any help here would be extremely appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Jonathan V.
Contributor
April 17, 2020

Please note that #2 in the list worked, and the issue was related to the fact that the transition I was trying to Fast-Track to was not available at the level I was using it.

In case anyone runs into this issue, now you know. :)

Sonya S_ July 13, 2022

hi, Jonathan, 

I runs into same scenario, neither #1~4 work.
my customer field is (Standard) number field, if I use == as equitation, it work.

however, it doesn't work by using >= or <= or > or < . 

Any advice to solve this ? Thanks in advance/ Sonya

image.pngimage.png

Jonathan V.
Contributor
July 14, 2022

Hi Sonya, my recommendation would be to test it out and see, as I know that many time it might show that warning, but only because at the moment, the system cannot determine what type of object the custom field contains.

I have seen these warnings before, but they actually work fine at runtime.

0 votes
Gikku
Community Champion
April 17, 2020

Hi @Jonathan V_ 

You can use the script runner condition 'Allows the transition if this query matches a JQL query' available in workflow conditions option.

Then you can drive the available transitions based on the JQL condition with the Amount field.

Jonathan V.
Contributor
April 17, 2020

Thank you for the response @Gikku 

The issue is that the logic is part of an automatic workflow process that I've built and the user is not actually deciding where it should go. They only see one option to approve and we do the rest in the background.

Suggest an answer

Log in or Sign up to answer