Hello everyone. I have a Jira Automation rule. In that rule I either create a Confluence page if it doesn't exist, in Confluence. And if it does exist, I update the page. I run the rule using a cron schedule. Every morning at 06:00 from Monday through Friday. For testing purposes I can run the rule manually by clicking "Run Rule".
After running the rule I go to the page in Confluence. The page is filled with Jira issues and a table for each issue containing the comments of that issue. Now, the issue that I am facing is a strange one.
Once the page is created at 06:00 by the cron schedule, it is re created multiple times per day, but every time the page is recreated, it is completely blank. On the page it says something like: "Created by MyName 31 minutes ago" even when I open the page at 12:00 during the day.
When I go to the audit log of the Jira Automation rule, it says it only ran once at 06:00 which is the time it is supposed to run. After that there are no signs of execution of the rule. So it seems to me that something strange is going on that is causing the page to get recreated every time but I have no clue what it could be.
A colleague of mine told me that once a page is created, the ID can be subject to change. Meaning that it could change and that the ID will never stay the same. Could this be something that relates to the issue? I use the ID of pages when I need to update a page.
My rule:
Step 1 : Trigger : Cron schedule = 0 0 6 ? * MON,TUE,WED,THU,FRI * : JQL = Sprint in openSprints() AND project = myProject
Step 2 : JQL condition : (updated < now() AND updated >= startOfWeek("+1d")) AND (comment ~ "anything*" OR comment !~ "anything*")
Step 3 : create variable ( pageTitleGET ) : smart value = 'Weekrapportage%20myProject.%20Week:{{now.weekOfYear}}%20Jaar:%20{{now.Year}}'
Step 4 : create variable ( pageTitlePOSTandPUT ) : smart value = Weekrapportage myProject. Week:{{now.weekOfYear}} Jaar: {{now.Year}}
Step 5 : Webhook GET : url = https://confluence.mycompany.nl/rest/api/content/search?cql=title={{pageTitleGET}}&limit=1 : Custom body = { "status": "current" } : Wait for response = checked
Step 6 : create variable ( pageBody ) : smart value = Deze weekrapportage laat alle comments op issues zien die de afgelopen week zijn gewijzigd! Als er géén wijzigingen in kaartjes zijn doorgebracht dan is deze pagina (nog) leeg! {{#issues}} key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution{{key}} Klik op mij om het commentaar van de story te zien!{{#comments}}{{/}} Datum Gebruiker Commentaar {{created.format("dd-MM-yyyy HH:mm:ss")}} {{author.displayName}} {{body.jsonEncode}} {{/}}
Step 7 : IF statement : 2 equals conditions : = {{webhookResponse.status}} equals 200 & {{webhookResponse.body.results}} contains myCompany
Step 8 (inside IF) : create variable ( pageID ) : smart value = {{webhookResponse.body.results.id}}
Step 9 (inside IF) : Webhook GET : url = https://confluence.mycompany.nl/rest/api/content/{{pageID}}?expand=version : Custom body = { "status":"current" } : Wait for response: Checked
Step 10 (inside IF) : create variable ( pageVersion ) : smart value = {{#=}}{{webhookResponse.body.version.number}} + 1{{/}}
Step 11 (inside IF) : Webhook PUT : url = https://confluence.mycompany.nl/rest/api/content/{{pageID}} : Custom body = {"id":"{{pageID}}", "type":"page", "title":"{{pageTitlePOSTandPUT}}", "space":{"key":"mySpace"}, "body":{"storage":{"value": "{{pageBody}}","representation":"storage"} }, "version":{"number":{{pageVersion}} }} : Wait for response: Checked
Step 12 : ELSE statement : Webhook POST : url = https://confluence.mycompany.nl/rest/api/content : custom body : {"type":"page","title":"{{pageTitlePOSTandPUT}}","space":{"key":"mySpace"},"ancestors":[{"id":2756609130}],"body":{"storage":{"value":"{{pageBody}}","representation":"storage"}}} : Wait for response NOT checked
And to describe what it is supposed to do in a more readable format:
1: run every morning at 06:00 from monday to Friday and find me all issues from my project that are currently in the active sprint
2: filter those issues so that I only have the issues that have been updated this week and have comments
3: create a variable that I can use in the URL of the rest api
4: create a variable that I can use in the body of the rest api
5: try to find the page by looking for the page title using the variable in step 3
6: create a variable that holds the body that displays the issues on the page that has to be created or updated
7: IF statement where we check if the response is OK and if there is a page returned that contains the word myCompany
8: inside the if we know the page exist, so create a variable that saves the pageID for the update call later on
9: search for the page with the ID we just found so that we can fetch the version of the page
10: create a variable where we increment the existing version with 1 so that we have a new version available for the update call
11: update the existing page by using the variables we created before, including the version, pageID and the body
12: inside the else we know the page does not exist, so create the page by using the title and body and create it inside the ancestor page
This is the audit log of the rule:
As you can see it only runs once a day at 06:00. On the 25th I ran it manually once to see if it worked. It updated the already existing page and showed the jira items, table, comments etcetera. Only to dissapear after a few hours as a new empty page was recreated.
So I have been facing this issue for a while now. I have been told by my system administrator that they are facing some issues in our Confluence environment regarding caching and issues with the search function in calls such as the GET webhook in step 5 where I use search?.
Also, even when disabling the Jira Automation rule AND removing the page in Confluence, the page is still getting recreated, so it seams that the rule is still running or maybe even restarting in the background as a proces maybe? I have also found that the older page is getting deleted before a new one is created because the recycle binnn was filled with hundres of the same page.
Anyways, I have now tried a different approach to step 5 using the query in a different manner like this:
https://confluence.mycompany.nl/rest/api/content/?title={{pageTitelGET}}
Instead of this:
https://confluence.mycompany.nl/rest/api/content/search?cql=title={{pageTitleGET}}
So far it seems to work. I will run the rule a couple of days to see if it actually works.
This is the correct answer. After a POST and a PUT, the page has not recreated in more than 15 hours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ano Niempje
Yes, your problem might be related to wrong PAGE ID..
You need to understand how PAGE ID is handled in Confluence (especially when there is a old version generated already). If you look at this topic you should get some information
So the main thing is to make sure (debug) what ID is used in your automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mirek thanks for your answer.
Before diving into the ID's my rule uses, I did some tests. I created 5 different scenario's creating pages in Confluence and kept track of their ID's.
This leaves me wondering if these page ID's are even subject to change.
My Jira Automation rule (as described in the OP) was triggered at 06:00 this morning. Because its the first day of the week and there was no page yet, the rule used the POST call to create the page. This means no PUT call has yet been triggered to update the page. This will happen tomorrow morning at 06:00. This also means the page only has one version.
Or so I thought. Prior to last weekend, I placed a few logs in between the rule to check what would happen with the ID. I noticed something strange. The first GET request tries to find a page and if the page exists, it will go into the IF clause. And if it doesn't, the ELSE clause.
At 06:00 this morning, the page that was checked in step 3 ( Weekrapportage%20myProject.%20Week:{{now.weekOfYear}}%20Jaar:%20{{now.Year}} ) should not have existed yet. Since today is a new week (week 14). But, it returned back positive, even giving me a page ID.
So it seems the GET request returns me a page that should not have existed yet. After that the page is succesfully (200, OK) updated by the PUT request.
Now I am wondering, either if the page exists already (maybe hidden) and if it does how is that even possible? Or is the GET request working differently than I am expecting?
This is the entire response from the GET call including the page ID:
response: {results=[{id=2827223082, type=page, status=current, title=Weekrapportage myProject. Week:14 Jaar: 2025, position=0, restrictions={}, _links={webui=/spaces/myspace/pages/2827223082/Weekrapportage+myProject.+Week+14+Jaar+2025, tinyui=/x/KgCEq, self=https://confluence.mycompany.nl/rest/api/content/2827223082}, _expandable={container=, metadata=, extensions=, operations=, children=, history=/rest/api/content/2827223082/history, ancestors=, body=, version=, descendants=, space=/rest/api/space/myspace}}], start=0, limit=1, size=1, cqlQuery=title='Weekrapportage myProject. Week:14 Jaar: 2025', searchDuration=122, totalSize=1, _links={self=https://confluence.mycompany.nl/rest/api/content/search?cql=title=%27Weekrapportage%20myProject.%20Week%3A14%20Jaar%3A%202025%27, base=https://confluence.mycompany.nl, context=}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And for your information, the last time the rule ran, which was last Friday 06:00, the GET request found this page:
Weekrapportage myProject. Week:13 Jaar: 2025
And today was created:
Weekrapportage myProject. Week:14 Jaar: 2025
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi so I wrote a huge update post that just dissapeard from this topic for some reason. The main point that I found was that the GET request in step 3 finds the page on monday 06:00 that has yet to be created. Which is strange because on Friday Weekrapportage myProject. Week:13 Jaar: 2025 is created and on monday 06:00 Weekrapportage myProject. Week:14 Jaar: 2025 should be created. But at 06:00 it already finds the page that is not supposed to exists. How is that possible, any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.