In my Jira automation I have a webhook that returns this JSON:
{ "entities": [ { "id": "1", "displayName": "Display name 1", "description": "" }, { "id": "2", "displayName": "display name 2", "description": "" } ] }
I'm trying to iterate over every "entity" to see if the "displayName" value equals my Jira automation smart value, {{displayNameCheck}}
I've managed to get it to kind of work by hard-coding the value of {{displayNameCheck}} into my if statement, but I can't seem to get it to work with the smart value.
Here is what is working:
{{#webhookResponse.body.entities}} {{#if(equals(displayName, "Display name 1"))}} {{.}} {{/}} {{/}}
However, I don't want to hard-code "Display name 1" into my if statement. I want to use {{displayNameCheck}}.
However,
{{#webhookResponse.body.entities}} {{#if(equals(displayName, displayNameCheck))}} {{.}} {{/}} {{/}}
does not work.
Nor does:
{{#webhookResponse.body.entities}} {{#if(equals(displayName, {{displayNameCheck}}))}} {{.}} {{/}} {{/}}
I've tried using advanced branching, however, advanced branching has a restriction on isolation (any changes in the branch won't be visible in the main rule), and I need to pass variables around to perform some API calls later in the automation ( link )
Is there any way to accomplish what I'm trying to do (iterate over a JSON array to see if one of the element properties equals my existing smart value)?
Thank you,
Nathan
Can you try this?
{{#webhookResponse.body.entities}}
{{#if(equals(displayName, ^displayNameCheck))}}
{{.}}
{{/}}
{{/}}
As far as I know, the ^ symbol is used to access variables/smart values outside the context.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.