Create from Template and Specify Parent Page

I really like the Create from Template macro, but it has its limitations. Here is what I want to do:

When the user clicks the button, a new page is created using a defined template and it is created under a specific parent page in, perhaps, another space.

For the macro itself, the user would have to specify the following parameters:

  • Space - The space where the template will be created (it would be nice to know how to create an autopopulating field as the user types space names)
  • Parent Page - The page within the space where all new content created from the template will be placed under
  • Template - The template to be used, of course
  • Button Text - The text on the button

Essentially it's nearly identical to the Create from Template macro, but it would allow a user to specify the parent page within a space under which the content is added.

I have tried, albeit unsuccessfully, to accomplish this. The best solution I have right now (as a band-aid until we have something more stable) is to create a new page using the template under the parent page. I then use that link as the place the button directs the user. It works, but it's sloppy and not easy for other users to make use of.

Has anyone created a macro like this? I can do most of the above, but I can't get the space to populate on its own or figure out how to specify the parent page. Any and all help is much appreciated!

5 answers

This widget could not be displayed.

 

I've just used this workaround in Confluence 5.5 and can confirm it works:

Take the URL from the normal create from template macro and change

&fromPageId=#######

to the id of the desired parent. You can then use a macro such as UI Button from RefinedWiki UI Toolkit to make it look nice :)

Can you elaborate please? Would love to use a workaround, but there is no URL in the Edit window for "Create from template" Macro. Thanks.

Apologies - I should have made it clear. This workaround doesn't actually use the "Create from template" macro, aside from to generate the original "create" URL. Here's the steps (should hopefully make more sense): 1. Add the Create from Template macro as usual, customising whatever settings you want, and preview or save the page 2. Right click on the button you just created and click "Copy link address" 3. Paste this address somewhere, e.g. Notepad. Example address: http://your-confluence-server/?templateId=4030475&spaceKey=TEST 4. Find the Id of the desired parent page (e.g. 123456) 5. Add &fromPageId=####### to the end of the address you pasted to Notepad (the example above would now be http://your-confluence-server/?templateId=4030475&spaceKey=TEST&fromPageId=123456) 6. Add this new address as a link to your Confluence page. Links aren't quite as fun as buttons, hence why I recommended using the UI Button from RefinedWiki UI Toolkit

Thanks, Angus! One other change I needed to make to get it to work: - I needed to actually click the button which the Macro created in order to get the full URL of https://[your-confluence-server].atlassian.net/wiki/pages/createpage-entervariables.action?templateId=[yourTemplateID]&spaceKey=[yourSpaceKey] - From there I could add the &fromPageId=[yourPageID] to the end, so the full URL looks like: https://[your-confluence-server].atlassian.net/wiki/pages/createpage-entervariables.action?templateId=[yourTemplateID]&spaceKey=[yourSpaceKey]&fromPageId=[yourPageID]

Good to hear you got it working - that'll teach me not to test my examples!

I've tried this work around, but it seems that no matter what I put for the &frompageid when I click on the new link it always takes me back to the space homepage (doesn't even try to let me enter the template). I have full access to the space and am on 5.6.4. Any ideas?

I'm having the same issue as Chris. I'm on a hosted instance. Any ideas?

Did you both follow Donata De Luca's workaround above? My answer has a mistake. Otherwise I'm afraid I don't know!

When I use the UI Button Hyperlink button and add the URL, it replaces the '&' with '&'. Did you have this same problem? If so, what did you do to get around the issue. 

@Honda Mx Racer I used the same macro and didn't encounter the issue...thanks everyone!

The "Create from Template" Macro was linked to following URL:

https://[my-confluence-server]/?templateId=10780750&spaceKey=ABC&newSpaceKey=ABC&title=%3CPageTitle%3E

I added the fromPageId mentioned by Angus and took the Path mentioned in Donata's post.  This modified string creates a new template with the given Parent page: 

https://[my-confluence-server]/pages/createpage-entervariables.action?templateId=10780750&spaceKey=ABC&newSpaceKey=ABC&title=%3CPageTitle%3E&fromPageId=10457192

Thank you both!

 

 

This widget could not be displayed.

I need to be able to specify the parent page. Desperately need this feature. Thanks!

This widget could not be displayed.

To have the button instead of the link, you can use wikimarkup macro with html and css code. I will publish it once I have it

This widget could not be displayed.

Have a look at the Page Tree Creator Plugin. It can do multiple Template Pages, has a Search & Replace process and in the button you can set the parent page (even in an other space ) as destination.

https://marketplace.atlassian.com/plugins/eps.focuspro.PageTreeCreator/server/overview

With the Space Tree Creator plugin you can create a space and then copy the Page Tree to this new space.

https://marketplace.atlassian.com/plugins/eps.focuspro.SpaceTreeCreator/server/overview

 

 

Paid plugins are not an option for us, as it just continues to drive up the cost of the tool that should be able to do many of these things.

This widget could not be displayed.

Another option to get your link into a button is to embed it in a div.

I used the following style information
background-color: #EEE; border-radius: 4px; border: solid 1px;color: #DDD;padding: 5px 15px;text-color:white;text-align: center;text-decoration: none;display: inline-block;font-size: 14px;margin: 4px 2px;cursor: pointer;

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

602 views 8 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you