Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to show project status based on number of issues

We use JIRA cloud in BT.

Based on the number of issues in a project, I want to show assign a colored status / label in Confluence page. How do I do it ?


E.g. If no of issues with project "XYZ" is greater than 5, I want to have a status / label with a RED indicator on top of a confluence page

1 answer

0 votes
Diego Atlassian Team Dec 13, 2018

Hello there Rahul!
Currently, Confluence Cloud does not have a native method or macro to achieve this result. However, some REST calls can be used to perform this change.

The first step would be to create a page with a status macro and also the Jira issues macro with only one issue from the desired project. With the status macro, we will be able to control the color of it later.

After creating the page, it is time to GET the page content via REST:

REST API - GET content

This will allow us to get two sets of data, the project key from the issue macro and also the status macro data. The numbers and dash (-) should be removed from the string so we can use the key only:

<p><ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="6f3f1181-9671-410c-90c4-a754f37523a2"><ac:parameter ac:name="server">JIRA</ac:parameter><ac:parameter ac:name="serverId">9de8af3e-0937-3d4b-8e79-933a2124cd43</ac:parameter><ac:parameter ac:name="key">WAG-11</ac:parameter></ac:structured-macro></p>

The value we need is under the ac:name="key" parameter.

Then, we need to check the number of issues for this specific project:

REST Client - get all issues of a project

The reply from Sayeed Ahmed is actually the one we are looking into right now. Using the key found under the issue macro we will be able to know how many issues the project has.

Lastly, we need to update the page content we got earlier to reflect the changes, based on the number of issues returned:

REST API - PUT content

For this, you will need to change two parts of the status macro, the ac:name="title" parameter and also ac:name="colour" parameter:

<p><ac:structured-macro ac:name="status" ac:schema-version="1" ac:macro-id="ecd9b86f-ac08-43b4-b1d5-800900b291f1"><ac:parameter ac:name="colour">Red</ac:parameter><ac:parameter ac:name="title">DONE</ac:parameter></ac:structured-macro></p>

This change will be based of on the arbitrary set of rules you created. Your code for this script need to have this "hardcoded" or to fetch this list of rules from somewhere else.
The reason that all these steps should be scripted is to avoid executing those calls manually after a given time interval. You can create this script using python, for example.

Let us know if this helps out your objective!

Thanks Diego for coming back on this.

I'm not a developer rather a super user in my company and trying to build a utility which shows project RAG which should automatically update its color based on issue number.

I'm going through the above recommendation step by step.

Could you pls tell me where can I invoke the REST API on my confluence page.

My current position is both macros are added - I've added a status and one-issue from a project.

where you able to do this?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

408 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you