hello,
I need to get last history changed of field "Target Sprint" from automation with web request.
the web request work good, when I display this log {{webResponse.body.changelog.histories.items.field}}
I get this result:
[Target Sprint], [Feature End Date], [Target Sprint], [Feature End Date], [Target Sprint], [Feature End Date]
but when I try to get last update of "Target Sprint" with this:
{{webResponse.body.changelog.histories.reverse().items.filter(it => it.field == "Target Sprint").first.to}}
I get empty result.
how can I get last value in history of "Target Sprint" field?
Thanks Shani
Hi @Shani Levi
Short answer: you may use smart value, list filtering and created variables to get the information you are seeking; or, you could use a rule triggered on a change to the field and save the changes in a custom field...which could be reviewed later, as needed.
More information...
First, I do not believe there is a reverse() or a filter() function for smart value lists.
The REST API endpoints for the changelog use paging, and thus even if those above functions existed, you would not necessarily get a result unless the automation rule performed paging of the changelog results using multiple calls with Send Web Request. https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-changelog-get
For the remainder of my suggestions, I will assume there is a change to the Target Sprint field in the first page of results from the changelog lookup...which by default are returned with the most recent one first.
You could use list iteration and conditional filtering to extract the entries for Target Sprint changes, adding a delimiter, and saving the result in a created variable. Then, split the variable on the delimiter and grab the first entry.
Here are some references to help you do that:
Kind regards,
Bill
but how I can get the value of "Target Sprint" from the history?
becouse I need to know if the Target Sprint was updated once time to value that is not empty.
Thanks Shani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If your rule is triggered on a change to that specific field (e.g., Issue Field Changed trigger), you may used the changelog smart value to check the {{fromString}} and {{toString}} to learn what it previously and currently contains:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this already and I got empty result,
{{#changelog.customfield_10181}}{{fromString}}{{/}}
or this {{changelog.customfield_10181.fromString}}
the automation trigger is on changes in field customfield_181 (Target Sprint field).
do you know why the changelog not work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved it with this command:
{{#changelog.Target Sprint}}{{fromString}}{{/}}
Thanks Shani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In some cases, the smart value or custom field may be used...but in others only one or the other works. I should have noted that the changelog in rules works more consistently with the smart value, not the custom field id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.