Forums

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

Compare {{webhookResponses.body}} values / Compare Smart Values Fields

Phil Walburn October 29, 2020

Hi,

 

I am trying to create an Automation that performs an action, based on the value of a field within the {{webhookResponses.body}}

My requirement is to perform an action based on the totalItems field in the body field of the response, which can be see here

log.png

I can access the field successfully, as shown by the following, which is displayed in Audit Trail by the Log command

total.PNG

But when I try an "if" statement, it doesnt seem to work

If.PNG

Any clues/tips on what I am doing wrong with this would be appreciated

thanks

1 answer

1 accepted

0 votes
Answer accepted
Nir Haimov
Community Champion
October 30, 2020

Hi @Phil Walburn 

Did you try to log {{webhookResponses.body.totalItems}}?

Just to check that it prints "0"?

If yes, can you show the log?
Share more clear screenshots?

Thanks

Phil Walburn October 30, 2020

Hi @Nir Haimov 

yes, I have Logges the totalitems, and confirmed that it prints 0

here are a clearer examples of the log

Totalitems.PNG

thanks

 

Phil

Nir Haimov
Community Champion
October 30, 2020

Hi @Phil Walburn 

Try to log the following:

{{webhookResponses.body.totalItems}} == 0

And also in different log:

 {{webhookResponses.body.totalItems}} == "0"

 Let me know the outcome 

Phil Walburn October 30, 2020

@Nir Haimov , Im not clear on how to incorporate that into an IF Block with the Jira Automation function

Is this what you meant ?

ifblock.PNG

(it didnt work)

Nir Haimov
Community Champion
October 30, 2020

Hi @Phil Walburn 

Yeah, that's what I meant.

What do you mean it didn't work?

What the log print?

Did you also try 0 (without quotes)?

Phil Walburn October 30, 2020

@Nir Haimov I have tried 0 with and without quotes

Here is an exampled of my code

Logging.PNG

So, as you can see, I Log the field value, and then I have and IF Statement to check the field, using quotes, and no quotes, and then and ELSE Statement to catch it, if it falls through

Below is the Log after execution 

audit.PNG

As you can see, it Logs the field value (0), then doesnt match the 2 IF Statements, and executes the ELSE Statement

Nir Haimov
Community Champion
October 30, 2020

Hi @Phil Walburn 

Sorry, but I really don't know, I tried similar thing in the past and it worked.

Hard to try fix something that you can't actually touch (but I tried) :)

Try to open a ticket about it to Atlassian.

Phil Walburn October 31, 2020

@Nir Haimov  .I got to the bottom of it 

I was checking the wrong field in the IF Statement !!

I left out the ".data." in the field name

thanks for your time and effort

Like Mark J Cunningham likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events