How do I fast-track a ticket based on the value of a custom field?

Amy Nguyen March 28, 2018

I am trying to fast-track a ticket when the value of a custom field is 0 or blank. I'm trying to use the script runner post function. I tried the followings and it didn't work for me

 

cfValues['Amount (Total Program)'] == '0' (this is for when value is 0)

cfValues['Amount (Total Program'] == '' (this is for when value is empty)

cfValues['Amount (Total Program'] == 'null' (this is for when value is empty)

 

Thank you!

 

2 answers

0 votes
Jenna Davis
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.
March 28, 2018

Hello, 

I believe you might just be checking for strings in your field based on your examples. By putting single quotes around null, you're causing the field to look for the string 'null' instead of a null value. 

Try this:

cfValues['Amount (Total Program)'] == null 

Or, if you want to check for a number (assuming this is a number field, not a text field), this:

cfValues['Amount (Total Program)'] == 0

Let me know if this helps, 

Jenna

Amy Nguyen March 28, 2018

Hi Jenna,

Thank you for your advice. It worked!! :)

Have a good day!

Amy

0 votes
Alexey Matveev
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.
March 28, 2018

Which condition did not work? for null values you can check like this

if (cfValues['Amount (Total Program'])

or 

if (cfValues['Amount (Total Program'] == null)
Amy Nguyen March 28, 2018

I tried

cfValues['Amount (Total Program'] == 'null' and that did not work. I double check and this field was empty. Any suggestions?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events