Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to get page id of published page in automation

Edited

I am creating an automation rule that creates a page from a template when another page is created (from a specific template) and as a child page.

I am able to create the automation rule and it functions as intended for everything above except creating the new page (lets call this page "b") under the original page that was created and that triggered the automation (let's call this page "a").

I know the publish new page action does not support creating under the page that triggered the automation BUT I am able to work around that gap by interacting with the confluence rest api through the "send web request" action.  I also have the send web request action working, however I need to reference the original page id (page "a")  to set as the parent for the new published page (page "b").

I see in the audit log there is a link to associated items which includes the published page. 

Is there a smart value I can reference to get the page id of that newly published page in the automation (page "b" in the example above)?  

1 answer

1 accepted

0 votes
Answer accepted
Tim Kopperud
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.
Oct 26, 2023

Hi @Julio Verano, if I understand your question correctly and page A is the page that trigger the rule and you create page B within the rule, you can use this smart value to fetch page As ID.

{{page.id}}

TimK.

Thanks Tim for the response!

Actually its the id of the new page created in the automation (page B in my example above) that I am needing to complete this automation - is there a smart value for that?

Tim Kopperud
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.
Oct 29, 2023

Hi @Julio Verano, I have looked deep into this to see if it's solvable.

It seems the page is created long after the rule is completed. Even trying to use webhook to another rule (rule 2) doesn't work because the page published in rule 1 is not even created when reaching rule 2. This concludes that you are not able to fetch the page id for any pages published within a rule. At last, this is how I understand it. 

The only idea I have to solve this is as follows:

You will need three rules for this approach, which are all triggered by When: Page published.

 

Rule 1 - for creating page B

First, add a filter needed for your scenario so you don't hit all published pages, but only those needed.

Add action And: Publish a new page, and use a template that contains the label "autocreated_page_b". 

 

Rule 2 - for moving page B, creating page C and remove label

Start with a filter If: Compare two values configured as

  • First value = {{page.label}}
  • Condition = equals
  • Second value = autocreated_page_b

Then add action And: Publish a new page, use a template that contains the label "autocreated_page_c".

Create action Then: Remove label to remove "autocreated_page_b" from this page as it's not needed any more. 

Since you now have the id from page B, using {{page.id}} here in rule 2, you can execute the move of page B using the REST API you mentioned. 

 

Rule 3 - for moving page C and remove label 

Start with a filter If: Compare two values configured as

  • First value = {{page.label}}
  • Condition = equals
  • Second value = autocreated_page_c

Create action Then: Remove label to remove "autocreated_page_C" from this page as it's not needed any more. 

Since you now have the id from page C, using {{page.id}} here in rule 3, you can execute the move of page C using the REST API you mentioned. 

 

Note

You will need to add labels to your two templates fpr page B and page C up front. You might swap the label names I have used to your own desire. 

Since the templates contains labels that passes the filters in rule 2 and 3 you must either

  • secure that the two templates are not used for other purposes, or
  • add addition logic to the filter e.g., add creator equals the ruleowner and/or  created within the last minute [ created <= now("-1m") ] etc.

TimK.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events