How to create nested sub-pages on clicking a button in parent page?

Kousalya S November 6, 2024

I need to create nested sub-pages upon clicking a button in parent page. I tried using REST Endpoint but I was getting 403 forbidden. I have also tried using custom event listener and set the event as PageUpdateEvent. 
Whenever I click update button in main page the script is being executed but on clicking the button in parent page, the script is not being executed and sub-pages are not being created.
Please let me know how to implement this.
Thanks in advance :)

2 answers

1 vote
Harrison Ponce
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.
November 6, 2024

I see two answers with built in features that might help!

1. You might try the Confluence smart button macro! They have some templates of automations you can do, like creating a new page, with/out a template, adding labels. There you can specify the parent page if it's always in the same space. Check it out, it might fit your use case! These are a bit limiting and do display on the page.

smart button nested.png

2. Confluence automation is great when you want to manually trigger actions from a page. This also allows you to set permissions for who can trigger the action and what space(s) they apply to. I tested this and it worked quite well! See screenshots below:

nested page 1.png

 

nested page 2.png

Kousalya S November 6, 2024

Thanks a lot @Harrison Ponce This helps. 

In my case I need to create some complex structure. 
And the name for the Sub-pages must match with specific content in the main page. 

For instance, if I have a table with two columns, I need to create sub-pages for every item in the first column; and for every item in second column, I need to create a second level sub-page under the respective sub-pages created for the 1st column.

So, I thought of extracting the page content and create nested sub-pages upon a button click using custom event listeners.

Harrison Ponce
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.
November 6, 2024

Ahh I see. This might be pushing the limits of what Confluence can do on its own and would require either a Forge app or some fancy scripting. May be helpful to look at if this can be accomplished differently using Jira integration or some other mechanism!

Happy to chat more about this interesting use-case if you would like to connect on a call.

0 votes
Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2024

Hi @Kousalya S and welcome to the community.

You can just click Plus, select Page and create a new child page.

2024-11-06_19-43-59.png

Pages are saved/published/updated on individual basis.

Perhaps you can elaborate more about what you're trying to achieve.

Kousalya S November 6, 2024

Thank you @Kristian Klima I am trying to automate the process. I need to create nested sub pages on a button click (which was added using HTML Macro) using groovy script. 

Sonia Jouini November 14, 2024

Hi @Kristian Klima , how can I change where this child page appears. The default setting has it appear at the buttom of the parent page. Can I reverse that (i.e. have it appear at the top)?

 

Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2024

Hi @Sonia Jouini and welcome to the community.

Just literally drag and drop the page where you want it to have - if you drop it onto another page, you create a child / parent page.

2024-11-14_18-26-20.gif

Sonia Jouini November 14, 2024

yes, I am aware of that. but it has become a pain to do this every time.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events