So am trying to create an automation based on a comma separated list of data that gets passed out to an external site/url then it collects the returns for the requests and put it in a comment.
Currently have this working like a treat except that each loop on the data creates a comment on a single result request.. so if I add 40 pieces of data I get 40 comments.
This works but is quite unreadable and wanted to create a table of results and pass that into a single comment in the issue.. is this possible?
For reference this is the data that currently goes in each comment:
Target: {{userProvidedListItem}}
š§¾ Response
- **HTTP Status:** `{{webResponse.status}}`
- **Message:** `{{webResponse.body.message}}`
- **Details:**
- `statusCode`: `{{webResponse.body.details.statusCode}}`
- `body`: `{{webResponse.body.details.body}}`
Ideally I'll process these a little differently before adding them to the comment.. for example if {{webResponse.status}} is 200 I don't need to record it - but if its 4xx or 5xx I should record it. So a resulting comment might be displayed as a Table such as:
Target | Message | code | body
=====================================================================================================================================
{{userProvidedListItem}} | {{webResponse.body.message}} | {{webResponse.body.details.statusCode}} | {{webResponse.body.details.body}}
{{userProvidedListItem}} | {{webResponse.body.message}} | {{webResponse.body.details.statusCode}} | {{webResponse.body.details.body}}
{{userProvidedListItem}} | {{webResponse.body.message}} | {{webResponse.body.details.statusCode}} | {{webResponse.body.details.body}}
{{userProvidedListItem}} | {{webResponse.body.message}} | {{webResponse.body.details.statusCode}} | {{webResponse.body.details.body}}
{{userProvidedListItem}} | {{webResponse.body.message}} | {{webResponse.body.details.statusCode}} | {{webResponse.body.details.body}}
Where each line (data and result) corresponds to each loop iteration.
Thanks,
Michelle
Hi @Michelle Sullivan -- Welcome to the Atlassian Community!
For a question like this, context is important for the community to help. Please post the following:
Until we see those...
Automation rule branch which could be on more-than-one-thing execute in parallel and asynchronously, with no guarantee of when the branch will finish up until the last step of the rule. (There is an in-progress suggestion to make this configurable, and we have no idea what Atlassian will actually implement for it.)
For your apparent scenario, the steps after the branch will start running before the branch completes, and so one comment would not be possible if each pass through the loop is calling out to a REST API endpoint.
Possible workarounds depend upon the number of items and your risk-tolerance for complex rules:
Kind regards,
Bill
Yeah thought that might be the result... Just refactored to try something different.. editing a known comment with the last result...
That also doesn't work most of the time .. seems that the branch iteration can edit the comment at the same time as another branch iteration wiping out it's result.. (ie no locking on a comment)
This is the rule:
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.
The result is:
I do however get 5 emails to the ticket and the API call has the 4 valid requests... so the branch is working.. just the results is "potluck" on which one is recorded.
As for the other parts.. it does mention/is tagged.. Jira Cloud/Premium
and finally:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, and...
Based on the rule shown I would expect the comment edits to collide frequently and "walk over" the prior results, and with no predictable order of processing due to the parallelism. Thus the final comment may not be correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Funny thing is, that's ok .. (comments being in any order) the issue is the dropping/walking over of results.I'm about getting the job done and recording that, rather than requiring a specific order of execution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see my earlier suggestions for workarounds; a single rule with a branch will produce unpredictable results in the comment edits.
Let's look at an similar example, where the branch values are A, B, C, and D, and we are just looping to add to the last comment's body:
As noted earlier, the order is unpredictable. But so is the content of that comment...
I hypothesize the {{currentComment}} smart value leads to an additional REST API call in the automation engine, but who knows what that contains as the loop progresses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What we need is like threading in C ... a 'pthread_join()' like function where the caller of the branch can pause waiting results of the entire branch. That way we could collate the parallelized call results and process them after all have been done. (because in my case I just need the results, I don't care about order.. and if order was something that mattered it would be trivial to fix that in what's available in automation now.)
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.