Forums

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

How to reference different smart value inside the list iteration

Haewon Kim
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 30, 2023

Objective: To iterate the comments of the triggered issue then retrieve the body of the comment that was edited the most recently.


This was so far what I could get, and it's stuck because I have no idea how to reference independent smart value inside the list iteration.

 

{{#issue.comments}}
  {{ if(equals({{issue.comments.updated.last}}, updated), body) }}
{{/}}

 

Then this fails because it's not using the proper syntax, especially "{{issue.comments.updated.last}}."

 

How can I achieve the goal to allow this iteration to check every comments' last updated datetime with {{issue.comments.updated.last}} smart value to populate the body of the comment with the most recent updated time?

1 answer

0 votes
Heryclles Henrique do Nascimento June 30, 2023

Hello, this is the json structure of a comment:

{
    "id": "2519688",
    "author": {
        "name": "herycllesh",
        "key": "JIRAUSER128011",
        "emailAddress": "heryclles_nascimento@sicredi.com.br",
        "avatarUrls": {
            "48x48": "https:currentinstance/secure/useravatar?ownerId=JIRAUSER128011&avatarId=72082",
            "24x24": "https:currentinstance/secure/useravatar?size=small&ownerId=JIRAUSER128011&avatarId=72082",
            "16x16": "https:currentinstance/secure/useravatar?size=xsmall&ownerId=JIRAUSER128011&avatarId=72082",
            "32x32": "https:currentinstance/secure/useravatar?size=medium&ownerId=JIRAUSER128011&avatarId=72082"
        },
        "displayName": "Heryclles Henrique do Nascimento",
        "active": true,
        "timeZone": "America/Cuiaba"
    },
    "body": "My Comment",
    "updateAuthor": {
        "name": "heryclles_nascimento",
        "key": "JIRAUSER128011",
        "emailAddress": "herycllesh@gmail.com",
        "avatarUrls": {
            "48x48": "https:currentinstance/secure/useravatar?ownerId=JIRAUSER128011&avatarId=72082",
            "24x24": "https:currentinstance/secure/useravatar?size=small&ownerId=JIRAUSER128011&avatarId=72082",
            "16x16": "https:currentinstance/secure/useravatar?size=xsmall&ownerId=JIRAUSER128011&avatarId=72082",
            "32x32": "https:currentinstance/secure/useravatar?size=medium&ownerId=JIRAUSER128011&avatarId=72082"
        },
        "displayName": "Heryclles Henrique do Nascimento",
        "active": true,
        "timeZone": "America/Cuiaba"
    },
    "created": "2023-06-30T13:01:03.209-0300",
    "updated": "2023-06-30T13:01:03.209-0300"
}

its smart value {{issue.comments.updated.last}} always returns the comment's update date there in the json structure, here are some examples:

{{issue.comments.body.last}} returns the body of the last comment
{{issue.comments.created.last}} returns the creation date of the last comment
{{issue.comments.author.displayName.last}} returns the display name of the author of the last comment
{{issue.comments.author.emailAddress.last}} returns the email address of the author of the last comment

Suggest an answer

Log in or Sign up to answer