You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I've spent several hours on this so I thought I would take a step back and ask for help.
On Confluence, each product our org works on has the same child page structure. For the sake of creating an example let's say this is the structure:
A - Company Products
A.1 - Perfect Product Name
A.1.1 - Perfect Product Name Requirements Document
A.1.2 - Perfect Product Name Creative Assets
A.1.2 - Perfect Product Name Guides
What I've been trying to do is create an automation, so that if I create a child page to "A - Company Products", for example the "A.1 - Perfect Product Name" page in the above example. That A.1.1, A.1.2, and A.1.3 will all be automaticallhy created from template as child pages to the newly created "A.1 - Perfect Product Name".
I've tried everything I can think of including trying to use confluence APIs with the "Send web request" automation, and the best I can do is create a generic file from template in a folder who's name I know, that already exists. Could anyone help me use Confluence automations to automatically create these child pages?
Any help would be greatly appreciated :)
Hi Joel,
You might be able to built something like this with our addon JavaScript Button for Confluence . Add a JavaScript Button to the very top of your Product Page and a field for the products name, like so:
Use the following code:
function createProduct(page, productName) {
const body = JSON.parse(page.body.atlas_doc_format.value);
const extensionKey = body.content[0].attrs.extensionKey;
return {
parentId: page.id,
spaceId: page.spaceId,
title: productName,
body: {
representation: "atlas_doc_format",
value: "{\"type\":\"doc\",\"content\":[{\"type\":\"extension\",\"attrs\":{\"layout\":\"default\",\"extensionType\":\"com.atlassian.confluence.macro.core\",\"extensionKey\":\"children\",\"parameters\":{\"macroParams\":{},\"macroMetadata\":{\"macroId\":{\"value\":\"47ab8f0b-766b-46f6-af0b-6c377c1f699d\"},\"schemaVersion\":{\"value\":\"2\"},\"title\":\"Children Display\"}},\"localId\":\"5ab88798-faf9-47ff-84b6-79f7e4a95c2c\"}},{\"type\":\"extension\",\"attrs\":{\"layout\":\"default\",\"extensionType\":\"com.atlassian.ecosystem\",\"extensionKey\":\"" + extensionKey + "\",\"text\":\"JavaScript Button (Staging)\",\"parameters\":{\"guestParams\":{\"resultLocation\":\"$page\",\"code\":\"async function createChildren(page) {\\n const productId = page.title.substring(0, 3);\\n const productName = page.title.substring(6);\\n return [{\\n parentId: page.id,\\n spaceId: page.spaceId,\\n title: productId + \\\".1 - \\\" + productName + \\\" Requirements Document\\\",\\n body: {\\n representation: \\\"atlas_doc_format\\\",\\n value: '{\\\"type\\\":\\\"doc\\\",\\\"content\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"text\\\":\\\"Add requirements.\\\",\\\"type\\\":\\\"text\\\"}]}],\\\"version\\\":1}',\\n }\\n },{\\n parentId: page.id,\\n spaceId: page.spaceId,\\n title: productId + \\\".2 - \\\" + productName + \\\" Creative Assets\\\",\\n body: {\\n representation: \\\"atlas_doc_format\\\",\\n value: '{\\\"type\\\":\\\"doc\\\",\\\"content\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"text\\\":\\\"Add creative assets.\\\",\\\"type\\\":\\\"text\\\"}]}],\\\"version\\\":1}',\\n }\\n },{\\n parentId: page.id,\\n spaceId: page.spaceId,\\n title: productId + \\\".3 - \\\" + productName + \\\" Guides\\\",\\n body: {\\n representation: \\\"atlas_doc_format\\\",\\n value: '{\\\"type\\\":\\\"doc\\\",\\\"content\\\":[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"text\\\":\\\"Add guides.\\\",\\\"type\\\":\\\"text\\\"}]}],\\\"version\\\":1}',\\n }\\n }]\\n}\",\"functionName\":\"createChildren\",\"cqlQuery\":\"\",\"caption\":\"Create Child Pages\",\"parameters\":\"$page\"},\"localId\":\"4839322d-e0c3-4ff9-9901-e14733e0bfab\",\"extensionId\":\"ari:cloud:ecosystem::extension/" + extensionKey + "\",\"extensionTitle\":\"JavaScript Button (Staging)\"},\"localId\":\"19454fdd-7ab4-40c9-882a-f09b95a2f549\"}},{\"type\":\"paragraph\"}],\"version\":1}"
}
}
}
Regards, Benno
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.