Forums

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

Confluence automation to transition a Jira work item based on Confluence page status

Summary

Recently, I encountered a requirement to automate Jira work item(s) based on the page status value of a linked Confluence page.

While Confluence automation offers an action to address Jira work item, the action in automation relies on JQL and there for acts on more issues then the linked Jira work item on the Confluence page

Also the Jira work item(s) are not placed on the page via a Smart link or Jira issues macro.

Screenshot 2025-04-17 at 15.07.59.png

Environment

Automation for Confluence and Jira Rest API

Context

This automation rule is based upon setting Confluence Page to page status "Rough Draft" and to transition the related PIR issue to status "Draft"

The rule can be adapted to your required requirements.

 

Solution

The below steps will help you to update the work item "status" related to the corresponding "page status".

  1. Create a confluence automation rule that triggers when the page status is changed and select the required page status.
  2. Create a variable
    Screenshot 2025-04-17 at 17.01.38.png
    The {{#debug}}<smart-value>{{/}} is there to also directly log the page id in the automation log.
  3. Add a Send web request action to get the Jira work item(s) where the Confluence link is set using and old server Rest API

    1. In the Authorization header make sure that you add the keyword Basic followed by the base64 of your emailaddress:APItoken. So if the base64 of the emailaddress:APItoken is AB12XY45 then to the Authorization header add the value Basic AB12XY45

    2. Add the following Web request URL:

      https://<Cloud site URL>/rest/api/jira-metadata/1.0/metadata?pageId={{pageid}}

       

    3. Add the Content-Type and "Application/JSON" header

    4. Check the option "Delay execution of subsequent rule actions until we've received a response for this web request" as the response contains the Jira work items linked to the Confluence page

      Screenshot 2025-04-17 at 17.17.03.png

  4. Create a variable or create an advanced branch The acton you choose is based upon if there are multiple issues linked to the Confluence page.

    For both count that they are based on the following smart value:
    {{webResponse.body.groups.items.name.flatten()}}
    1. Variable
      Screenshot 2025-04-17 at 17.27.38.png
    2. Advanced Branch
      Screenshot 2025-04-17 at 17.22.30.png

  5. Add a Send web request action to get the Jira work item(s) using the latest Jira Cloud API.

    Use the same headers as set in step 3

    Screenshot 2025-04-17 at 17.30.13.png
  6. Optional is to add a condition to make sure you will act on the right work item(s)

    In my case I want to transition only the linked PIR work item. This based on the result of the response of the Web Request

    Screenshot 2025-04-17 at 17.35.30.png
  7. Add a Send web request action to post the Jira work item(s) required transition using the latest Jira Cloud API.

    Use the same headers as set in step 3

    In my case I wanted based on the trigger transition the issue to status "Draft", in my instance this is the transition id "21"

    Screenshot 2025-04-17 at 17.44.27.png
  8. Publish the rule by giving it a name.

2 comments

Darryl Lee
Community Champion
April 18, 2025

This is great work @Marc - Devoteam !!

In case anyone doesn't know about the base64 Authorization thing, there's a good old article: Send web request using Jira REST API 

Like Marc - Devoteam likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2025

Hi @Marc - Devoteam 

Well done!

FYI -- There is a small typo in your step 3.2. where the "j" is missing from "jira".

https://<Cloud site URL>/rest/api/jira-metadata/1.0/metadata?pageId={{pageid}}

 

Kind regards,
Bill

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events