Stand with Ukraine 🇺🇦

Issue Worklogs — Confluence Cloud Macro

reporting

This user macro fetches worklogs from a Jira issue and displays them in a sortable table within a Confluence page. It uses the Jira REST API to pull data including creation date, author, time spent, and worklog comments. Comments are parsed from Atlassian Document Format (ADF) to plain text for readability. If no worklogs are available, a friendly message with a link to the issue is shown. The macro auto-updates when worklogs change, ideal for time tracking visibility or project retrospectives.

Try for free

User Parameters

Issue

Issue ID or Isse Key e.g. UM-333

Template

#set ( $worklogs = $JiraManager.get("/rest/api/3/issue/${parameters.issue}/worklog").worklogs)

#set ( $jiraURL = $StringUtils.replace($baseUrl, "/wiki", "") )
#set ( $issueURL = "${jiraURL}/browse/${parameters.issue}" )

#if(!$worklogs)
  No worklogs for issue <a href="$issueURL">${parameters.issue}</a>
  #stop
#end

<table class="aui">
      <thead>
        <tr>
          <th colspan="4"><center>Worklogs for issue <a href="$issueURL">${parameters.issue}</a></center></th>
        </tr>
        <tr>
          <th>Date</th>
          <th>Author</th>
          <th>Time spent</th>
          <th>Comment</th>
        </tr>
      </thead>
      <tbody>
  ## Loop through worklogs
  #foreach ( $w in $SortTool.sort($worklogs, ["created:desc"]) )
        <tr>
          <td>$StringUtils.substringBefore($w.created, "T")</td>
          <td><ac:link><ri:user ri:account-id="${w.author.accountId}"/></ac:link></td>
          <td>$w.timeSpent</td>
          <td>
            #if ( $w.comment ) ## Comment might be empty
              ## Parse comment from Atlassian Document Format (ADF)
              #foreach ( $c in $w.comment.content[0].content )
                #if ($c.type == "text")
$c.text 
                #end
              #end
            #end
          </td>
        </tr>
  #end

      </tbody>
    </table>