How to pre-populate page with information from another page?

Brian Sung September 10, 2018

Hi,

Where would be a good starting point to achieve this? Basically, I have a page with information and a button to create a new page. I want to use the preexisting information and insert it into the new page.

Thanks!

2 answers

1 vote
Robert Reiner _smartics_
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.
September 11, 2018

The Create from Template Macro allows you to render a button to create a new page based on a blueprint or template.

To include information from the page that host that button you would need some form of excerpt. In this case the content would update once the information in the hosting page is updated. If this is not the case I suppose you would need to do some programming (at least I do not know of a tool that would do this out of the box).

If the  Excerpt and Excerpt Include Macro you would place in the new page would be too limited (because only one fragment of a page is 'excerpted'), you could check out third-party add-ons that support multi-excerpt.

Brian Sung September 11, 2018

Hi Robert,

Thank you for your response! This is getting on the right track but it's not quite the solution. I have to include information from the host page and output the information onto a new page, however the host page is based off a template. When I tried to edit the template, it cannot find it because it's not a "page" yet. Any suggestions on which approach I should take to make this work?

Thanks,

Brian

Robert Reiner _smartics_
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.
September 11, 2018

I'm not sure that I understand your problem correctly.

As I understood your use case you would create a new page and this new page should include information from the parent page. Is this correct?

I suppose that the hosting (parent) page is based on a different template than the to-be-created child page. Is this correct?

I assumed that you could hard-code the name of the parent page into the template the child page is created from (at least if the template is edited in its XML source). I do not use the Excerpt Macros from Confluence for this myself since I use a third party tool with multi-excerpt features (combined with page blueprints where you may have finer control on the creation process due to ContextProviders) for similar scenarios. So maybe I assumed here too much?

The suggested solution would be to add the Excerpt Macro to the host page and by (maybe some magical means) have the blueprint for the child page contain the Excerpt Include Macro that points to the excerpt from the parent page.

If you have both parent and child based on blueprints and therefore cannot rely on hard coding the page reference in the macro parameter, then the only solution I can suggest is to write an add-on and determine the parent in the ContextProvider to generate the reference for the Excerpt Include Macro. I have suggested a similar solution I use to enter a reference to a space in How can I get the space-key into my space blueprint template?. Having a reference to a document should be similar. But I assume that this is a hack. It works, but I believe to remember that the value of a macro parameter must not be a variable. Unfortunately I cannot find the source for this.

Hope this helps?

1 vote
Deleted user September 11, 2018

Hi @Brian Sung,

 

You can achieve this using Create from Template Macro. Here is the link for your reference.

 

Thanks,

Sravya

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events