Stand with Ukraine 🇺🇦

Issues Assignee History — Confluence Cloud Macro

reporting

This user macro retrieves a list of Jira issues using JQL and displays their assignee change history in a structured table within Confluence. For each issue, the macro shows a clickable issue key linking to Jira, the issue summary, and a chronological assignee path using user mentions. It leverages Jira’s changelog via the REST API to detect assignment changes, sorts them by creation time, and presents the sequence using '>' notation. If no results match the JQL, it displays a helpful message.

Try for free

Template

## Search for issue with key, summary, and changelog included
#set ( $issues = $JiraManager.get("/rest/api/3/search/jql?fields=key,summary,assignee&expand=changelog&jql=${parameters.jql}").issues )

## Jira URL is a Confluence baseURL, but w/o "wiki/"
#set ( $jiraURL = $StringUtils.replace($baseUrl, "/wiki", "") )

## Check for empty result
#if(!$issues)
  No issues for JQL <code>${parameters.jql}</code></a>
  #stop ## End of execution, there is nothing to render
#end

<table>
      <thead>
        <tr>
          <th>Issue</th>
          <th>Summary</th>
          <th>Assignee history</th>
        </tr>
      </thead>
      <tbody>
  
  ## Loop through issues
  #foreach ( $i in $issues)
  
        <tr>
          <td style="white-space: nowrap;"> ## "nowrap" for issue key to be in one line 
            <a href="${jiraURL}/browse/${i.key}">$i.key</a>
          </td>
          <td>$i.fields.summary</td>
          <td>
          #if ( $i.changelog.histories )
        
            ## Sort history items by creation date ascending 
            #set ($sortedHistory = $SortTool.sort($i.changelog.histories, ["created"]))
            #foreach ( $h in $sortedHistory )
              #foreach ($item in $h.items)
                #if ($item.fieldId == "assignee")
                  #if ($item.from)
<ac:link><ri:user ri:account-id="${item.from}"/></ac:link> → 
                  #else
<span class="aui-lozenge aui-lozenge-subtle">unassigned</span> → 
                  #end
                #end
              #end
            #end
          #end
          ## Current Assignee
          #if ($i.fields.assignee)
<ac:link><ri:user ri:account-id="${i.fields.assignee.accountId}"/></ac:link>
          #else
<span class="aui-lozenge aui-lozenge-subtle">unassigned</span>
          #end
          </td>
        </tr>
        
  #end

      </tbody>
    </table>

User Parameters

JQL

Jira Query Language expression for filtering needed issues