Create child page from template with prefilled title

Deniz Perz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 12, 2022

Hello!
I have a parent page named "page 1".
On it I want to place the "Create from template" button.
At the same time, I need that when the "Create from template" button is pressed, a child page is created with a pre-filled title, for example (Documentation + page 1). That is, the title of the child page should automatically fill in the title with two variables, this is an arbitrary text + the title of the parent page.

What solutions are currently available? How can I implement it?

2 answers

1 vote
Patrick Vanhoof
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.
October 14, 2022

I do not think this is possible with the 'Create from template' macro.

We have the Scriptrunner for Confluence add-on, that has a 'create page' macro with lots of possibilities.

Marianne Lee (Nagarro) November 24, 2022

Hi @Patrick Vanhoof, do you know I can create a new page from a template while passing a custom variable $myVariable to the template to generate content? At the same time the page title uses $myVariable as a prefix, how can this be done without having to enter the value twice for $myVariable?  Can this be achieved using the "Create Page" macro by ScriptRunner ?

Patrick Vanhoof
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 24, 2022

@Marianne Lee , the variable in the template works as with the create from template macro, you get a screen first where you enter the variabler value.

But as far as I can see, the use of that variable in the Create page macro is not possible. Correct, @Jessie Wang_ScriptRunner_The Adaptavist Group ?

0 votes
Jessie Wang_ScriptRunner_The Adaptavist Group
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 14, 2022

Hi @Deniz Perz are you on an on-prem instance? If so you can achieve this with ScriptRunner for Confluence and our 'Create Page' macro as mentioned by Patrick above.

In our documentation, there is a short 1:30min video that will give you a demo of what the macro does. You can watch it to see if it meets your needs. https://docs.adaptavist.com/sr4c/latest/features/macros/built-in-macros/create-page.

ScriptRunner for Confluence is available for a 30-day free trial if are interested in testing it out. https://marketplace.atlassian.com/apps/1215215/scriptrunner-for-confluence?tab=overview&hosting=cloud

Any other questions feel free to ask!

Marianne Lee (Nagarro) November 24, 2022

Hi @Jessie Wang_ScriptRunner_The Adaptavist Group , I have ScriptRunner for Confluence (server) and exploring the possibilities with extending the "Create Page" macro by ScriptRunner.

My goal is to create a new page from a template while passing a custom variable $myVariable to the content body from page template. At the same time the page title uses $myVariable as a prefix.

 

1. Is it possible to create a custom class to extend the CreatePageMacro? I've not been able to succeed as described in Customising Macro Variables.  Do you have any code examples?  

2. Is it possible to grab a value from a table in a current Confluence and pass it on to CreatePageMacro? 

otherwise,

3. Can the value from <Prompt Title> in "Create Page" macro be passed to a page template?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events