In my automation I'm calling the Atlassian API and want to populate a variable based on the following condition:
{{if(or(webResponse.body.id.contains("customfield_1"),webResponse.body.id.contains("customfield_2")),"fieldsPresent","fieldsNotPresent")}}
For a question like this, context is important for the community to help. Please post the following:
Until we see those...
Would you please confirm, are you testing for a match to the value of custom fields in the web response body, or to the literal text "customfield_1"?
And, there is no contains() function in smart values, and thus other methods must be used.
Kind regards,
Bill
Hi @Jared Schmitt
Yes, the "contains" is not supported.
Instead, you can try to use match()
{{if(or(webResponse.body.id.match("customfield_1"),webResponse.body.id.match("customfield_2")),"fieldsPresent","fieldsNotPresent")}}
Please try the above-mentioned one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the fast reply. I tried that and didn't change the result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Jared Schmitt
If match() also didn't work, it can be because it wasn't applied to a string.
Try this one, please.
{{if(
gt(
webResponse.body.asJsonString.match("(customfield_(?:1|2))").size,
0
),
"fieldsPresent",
"fieldsNotPresent"
)}}
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.