Hello community,
I've added a webhook component to my Jira automation flow to gather all sprints (https://jira.hel.kko.ch/rest/agile/1.0/board/18307/sprint)
To process the response and find a specific sprint, I used
{{#webhookResponse.body.values}}{{#if(equals(name,"abc"))}}{{id}}{{/}}{{/}}which works fine.
Now I want "abc" not hardcoded but as variable or smart value of the issue field "issue.customfield_12919".
But neither
{{#webhookResponse.body.values}}{{#if(equals(name,issue.customfield_12919))}}{{id}}{{/}}{{/}}nor
{{#webhookResponse.body.values}}{{#if(equals(name,issue.{{customfield_12919}}))}}{{id}}{{/}}{{/}}nor
{{#webhookResponse.body.values}}{{#if(equals(name,variable))}}{{id}}{{/}}{{/}}works here.
Without the curly brackets, the code line gives me an empty response. With the curly brackets, the code line gives the error "parameters not closed". Even with the variable, it gives me an empty response.
Any ideas how to pass a smart value or variable in this line of code?
Thx in advance and best regards
Stefan
Hi
When using long-format list iteration, only data from that scope (and lower) is visible. Thus, outside work item fields, variables, etc. cannot be used. Worse still, there is a long-standing defect where some functions within an iterator can only interact with the first item in the list, regardless of how many items are present.
There are several workarounds, including:
To learn more, please see this article I wrote on the topic...including the comments explaining some specific scenarios.
Kind regards,
Bill
Hi Bill,
thx for your hints und your article about this topic. I've read it and it looks like these ideas mentioned in the article could be a workaround for my issue.
Before seeing your ideas, I've done some research and for me the easiest solution currently is to switch to another web service (https://jira.hel.kko.ch/rest/greenhopper/1.0/sprint/picker?query={{issue.customfield_12919.value}}) to get the correct sprint.
So currently I will continue with that but will keep your suggestions in mind.
Thx
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI I believe the Greenhopper REST API endpoints were deprecated a long time ago, so "buyer beware" when using them as they may disappear without notice.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've debugged a bit to this and it looks like that variables aren't accessable inside the loop of
{{#webhookResponse.body.values}}My test (value of customfield_12919 is "abc"):
variable = issue.customfield_12919
{{equals(variable, "abc")}} gives me true.
{{#webhookResponse.body.values}} {{equals(variable, "abc")}} {{/}} gives me false.
It is the same line of code, just inside the loop of my webhook response array. And when inside the loop, "variable" seems not to be accessable.
I've also tried with "vars.variable" to explicit use it in global context.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
maybe this corresponds to https://jira.atlassian.com/browse/AUTO-239 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to the community.
What is the name of the custom field?
It should be like: {{#webhookResponse.body.values}}{{#if(equals(name,issue.<name of field>))}}{{id}}{{/}}{{/}}
So as example: {{#webhookResponse.body.values}}{{#if(equals(name,reporter.displayName))}}{{id}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
the name of the custom field is "customfield_12919".
I've already tried
{{#webhookResponse.body.values}}{{#if(equals(name,issue.customfield_12919))}}{{id}}{{/}}{{/}}without success.
Best regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No this "customfield_12919" is the ID not the name of the field.
What is the name of the field on the issue itself?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The name of this field is "Major Release".
Do I have to put the name in the code line instead of the id or variable?
Please have a look at my other findings, especially that this could be related to https://jira.atlassian.com/browse/AUTO-239
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.