Stand with Ukraine 🇺🇦

Display Jira Work Items — Confluence Cloud Macro

reportingexternal-content

This Confluence user macro uses the Jira Cloud REST API to fetch and display all available issues or filtered based on a project.

The macro retrieves issue type, key, summary, assignee, status, and date updated and displays all of that as the AUI table.

Try for free

Template

## Normalize date format
#set ($format = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")

## Normalize base URL
#set ($baseUrl = $StringUtils.replace($baseUrl,"/wiki",""))

## Read a project param or use all issues
#set ($projectName = $parameters["project"])

#if ($projectName && $projectName != "")
#set ($jql = "project = '$projectName' ORDER BY updated DESC")
#else
#set ($jql = "project IS NOT EMPTY ORDER BY updated DESC")
#end

## Fetch issues
#set ($issuesUrl = "/rest/api/3/search/jql?maxResults=50&jql=${jql}")
#set ($issues = $JiraManager.get($issuesUrl))

## Render empty state
#if (!$issues.issues || $issues.issues.size() == 0)

<p>
    We looked everywhere, but it seems there are no issues for now 😔
</p>

#else

## Render results
<table class="aui aui-table-sortable">
    <thead>
        <tr>
            <th>Type</th>
            <th>Key</th>
            <th>Summary</th>
            <th>Assignee</th>
            <th>Status</th>
            <th>Updated</th>
        </tr>
    </thead>
    <tbody>

        #foreach ($item in $issues.issues)
        #set ($issue = $JiraManager.get("/rest/api/3/issue/${item.id}"))

        ## Extract issue type & status
        #set ($typeName = $issue.fields.issuetype.name)
        #set ($typeIcon = $issue.fields.issuetype.iconUrl)

        #set ($statusCat = $issue.fields.status.statusCategory.key)
        #if ($statusCat == "done")
        #set ($lozengeClass = "aui-lozenge-success")
        #elseif ($statusCat == "indeterminate")
        #set ($lozengeClass = "aui-lozenge-current")
        #else
        #set ($lozengeClass = "aui-lozenge-subtle")
        #end

        <tr>
            <td>
                <img
                src="$typeIcon"
                title="$typeName"
                alt="$typeName"
                width="18"
                height="18"
                style="cursor: help;"
                />
        </td>

        <td>
            <a href="${baseUrl}/browse/${issue.key}">$issue.key</a>
        </td>

        <td>
            <a href="${baseUrl}/browse/${issue.key}">
                $issue.fields.summary
            </a>
        </td>

        <td>
            #if ($issue.fields.assignee)
            #if ($issue.fields.assignee)
            #set ($assignee = $issue.fields.assignee)
            #set ($accountId = $assignee.accountId)
            #set ($profileUrl = "${baseUrl}/wiki/people/${accountId}")

            <span class="assignee">
                <a href="$profileUrl" target="_blank">
                    $assignee.displayName
                </a>
            </span>
            #end
            #else
            —
            #end
        </td>

        <td>
            <span class="aui-lozenge aui-lozenge-subtle $lozengeClass">
                $issue.fields.status.name
            </span>
        </td>

        <td>
            $DateUtils.parseDate($issue.fields.updated, $format)
        </td>
    </tr>

    #end

</tbody>
</table>

#end

<script>
AJS.toInit(function () {
AJS.$(".type-tooltip").tooltip();
});
</script>

User Parameters

Project

Enter a project name to filter issues