Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get property from parent level when checking condition in child level?

Gokaraju gopi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 29, 2025

{{#webResponse.body.values}}{{#items}}{#if(equals(fromString, "In Progress"))}}{{/}}{{/}}{{/}}

How to get created property from values when fromString property is matched inside items?

 

Use example response from /rest/api/3/issue/{issueKey}/changelog api

2 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 29, 2025

Hi @Gokaraju gopi 

The suggestion you got from the other tool is not correct; there is a limitation for the long-format of smart values iterators: once inside the iterator, only data from that scope and lower is visible.

For your scenario, the created attribute cannot be "seen" once inside the {{#items}} ... {{/}} iterator as it filters to that scope.

 

One workaround is using the inline iterator and the match() function rather than a nested, long-format iterator.  For example:

{{#webResponse.body.values}}
{{#if(items.toString.match("^(In Progress)").size.gt(0))}}
{{created}}
{{/}}
{{/}}

Please note this could return multiple created values for the changelog entries, so decide how you want to handle that...such as adding delimiters and parsing the results.

 

Also, it appears you are doing this for the Status field entries in the changelog, so perhaps instead use the Bulk Fetch Changelogs endpoint as that allows filtering by the field(s):

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-changelog-bulkfetch-post

 

Kind regards,
Bill

Gokaraju gopi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 30, 2025

Hi @Bill Sheboy ,

This API helped me to improve my logic. Thanks for sharing it. I had one more question on the created date. The bulk fetch changelog api was returning created": 1689316751665.

Below is example response

{
                    "id": "11054",
                    "created": 1689316751665,
                    "items": [
                        {
                            "field": "status",
                            "fieldtype": "jira",
                            "fieldId": "status",
                            "from": "10002",
                            "fromString": "Done",
                            "to": "3",
                            "toString": "In Progress"
                        }
                    ]
                },

How can I convert that to jira dates so that I can update the same in date field? Tried all functions from jira dates but that did not worked https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

 

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 30, 2025

Hi @Gokaraju gopi 

That endpoint returns the UNIX timestamp (from the start of day on 1 Jan 1970).  And thus the number could be added to that date / time to get the value. 

When you expect the changelog to have lots of entries and the Status change is not in the first 100 of them, use this approach with the bulk changelog endpoint.

 

When you believe there are fewer changelog entries, another approach is continuing to use your original issue get endpoint with the changelog parameter and add the filter for the Status field:

{{#webResponse.body.values}}
{{#if(and(items.toString.match("^(In Progress)").size.gt(0), items.field.match("^(status)").size.gt(0)))}}
{{created}}
{{/}}
{{/}}

 

Like Gokaraju gopi likes this
Gokaraju gopi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 31, 2025

Its working now with

{{apochDate.toDate.plusMillis(firstInProgressDate.asNumber)}}

Where

apochDate = {{now.withYear(1970).withMonth(1).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withMillis(0).convertToTimeZone("UTC")}}

 

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 31, 2025

Well, done!  You could also use this expression for the Epoch date / time:

{{now.withYear(1970).withDayOfYear(1).toDateTimeAtStartOfDay}}

 

And, if my suggestions helped, please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

0 votes
Gokaraju gopi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 29, 2025

Got following suggestion from Handlerbars but it was not working in jira smart values in automations

 

{{#webResponse.body.values}}
  {{#items}}
    {{#if(equals(toString, "In Progress"))}}
      {{../created}}
    {{/}}
  {{/}}
{{/}}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events