Greetings all, I'm reaching out to understand if anyone has faced this need or is aware if any 3rd party add-ons provide this type of functionality.
Our users are looking to apply a space-level template (customizations) to a page created from a global template. I've looked into doing this with Confluence Automation and from what I found, it was not feasible. I'll outline what I've tried below, the bolded items are the blockers.
Trigger: 'When page published'
Condition: "If {{content.labels}} contains 'label-name'" AND
Condition: "If {{space.key}} equals 'spaceKey'"
Action: HTTPs call to get the local space template's body (this does not seem to be feasible?)
Action: Merge page body (global template) with retrieved space template body
Action: Update/Publish page
Any insights here are much appreciated! I think the only options I'm left with are a custom macro using Forge or possibly ScriptRunner?
Hi Matt,
You should be able to achieve this using a Forge app, though it'll require some javascript expertise.
If I understand your use-case, you shouldn't need a custom macro. Instead, I'd recommend either:
- using a Forge product trigger to listen to page events, and then performing the merge; or
- using a Forge content action to allow the user to explicitly trigger a merge via the context menu
Here's a few key APIs & Forge modules that may help:
- you can subscribe to page create & updated events via a Forge product trigger. However these aren't currently triggered when labels are applied, so you may prefer to use a Forge content action as described above (or rely on some mechanism other than labels to specify that a page should be merged with a template).
- content templates are available via the get content templates API (you can filter to a specific space by passing a `spaceKey` parameter, or omit `spaceKey` to get global templates)
- merging the content may be a complex operation, depending on the template structure and how you want the merge to work. One approach is to get the content of the templates in `atlas_doc_format` (which is JSON) and writing a merging function in your Forge app. You may find the ADF Builder useful to learn
If you're new to Forge, there's a tutorial for building a Forge content action @ https://developer.atlassian.com/platform/forge/macros-in-the-page/ that may help get you started.
cheers,
Tim
The easiest way to achieve this is to just create a copy of the blueprint as a space template, edit it the wayyoud like and save it with a slightly different name.
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.