Dear Jira Community,
I am working with the "equals" statements. But it seems odd that event the string equals "10403", the "equals" statement returns False:
Could you tell me why T_T?
===================================
//Smart Values Logic:
{{#webhookResponse.body.changelog.histories}}
{{items.to}}
{{equals(10403, items.to)}}
{{/}}
====================================
//Output:
XYZ-6604
false
JIRAUSER41800
false
12700
false
10403
false
Finally I'm able to fix it:
{{#if(equals(items.get(0).to, "10403"))}}
Hi, @Huynh BKFET
If you're trying to compare integer and string, they won't be equal.
Have you tried including 10403 in quotes? Like:
//Smart Values Logic:
{{#webhookResponse.body.changelog.histories}}
{{items.to}}
{{equals("10403", items.to)}}
{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then, there is something wrong with value items.to. I checked equals logic, just with raw values, like {{equals("10403", "10403")}}, it returns true
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As you can see, when I output the {{items.to}}, it shows: 10403,which is weird!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could there be any whitespace around the value?
Might try a few things off https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields
Such as
{{equals("10403", items.to.trim())}}
{{items.to.equals("10403")}} or {{items.to.equals(10403)}}
What about any hidden, non-printable characters.. if you let it print
{{items.to.htmlEncode}}
Anything weird, maybe some unicode control character or something?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Really weird.
Maybe whitespaces?
Try to trim value, like this:
{{items.to.trim()}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Radek Dostál , the items.to.equals("10403") works as a charm.
though, I am having difficulty wrapping items.to.equals("10403") inside an if statement as follows:
start
{{#webhookResponse.body.changelog.histories}}
{{if(items.to.equals("10403"))}}
{{items.to.equals("10403")}}
-------------
{{/}}
{{/}}
end
it reports an error as follows:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Huynh BKFET Hello. Were you able to resolve the above? Even for me wrapping equals inside a if doesn't work? If you were able to solve it, please suggest.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for late reply @amruth.vairamani , I have fixed this.
{{#webhookResponse.body.changelog}}{{#histories}}{{#if(equals(items.get(0).to, "12700"))}},{{created}}{{/}}{{/}}{{/}}
items is a list, so we need to get by index. In this case, we get the first one: items.get(0)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.