Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
show-titlefalse
titleDescription

The Create-from-Template Macro is used by blueprint of the projectdoc Toolbox PDAC1 for Confluence frequently. Every home page has this button to create new top-level document instances easily. Also many doctypes use these macro to make it easy to add new document instances of a given type. For instance the Day Doctype allows to add new Events or Assets Todos as child documents of the current Day Document.

There are some inconvenience involved, though. This article explains them so that especially new users hopefully are less confused.

  1. Preselection of Blueprint
  2. Copy and Paste Issue
Section
titleSummary

For those TL;DR:

  1. Do not edit the Create-from-Template Macro found on projectdoc documents
  2. Do not copy/move projectdoc documents with Create-from-Template Macros without checking the Space key parameter
Section
titlePrerequisites

Section
titlePreselection of Blueprint

This issue is not very easy to catch.

Section
titleThe normal Use Case

The HTML buttons that are rendered on the projectdoc documents work as expected. If you are on the home page of a doctype and click the button, a new document based on that doctype is created.

The Create from Template Macro rendered as HTML buttonImage RemovedThe Create from Template Macro rendered as HTML buttonImage Added

If you click on "Create Todo", the blueprint wizards starts to create a new Todo Document.

Correct Doctype Blueprint Wizard is startedImage Modified

So far so good.

Section
titleThe Problem

Now if you open the Macro editor Editor for the Create-from-Template Macro, you will see this:

Create-from-Template Macro in the Macro EditorImage Modified

You would assume that the Template name parameter shows "Todo" instead of "Annual Vision". In fact, the macro editor Macro Editor simply shows the first entry in the list.

As long as you do not save the contents of the Macro Editor, everything will just work fine. But if you do, the next document created will be based on "Annual Vision" instead of "Todo".

Section
titleRecommendation

So the rule here is:

  1. Do not edite the Create-from-Template Macro
  2. If you need to edit it: Make sure to select the correct template before saving!
Section
titleWhy is this so confusing?

As template autor author we can select the name of the blueprint. Since template autors authors work on the XML Storage Format of Confluence, it looks like this:

Code Block
languagexml
<ac:structured-macro ac:name="create-from-template">
  <ac:parameter ac:name="blueprintModuleCompleteKey">de.smartics.atlassian.confluence.smartics-projectdoc-confluence-space-devdiary:projectdoc-blueprint-doctype-todo</ac:parameter>
  <ac:parameter ac:name="createResult">edit</ac:parameter>
  <ac:parameter ac:name="buttonLabel">Create Todo</ac:parameter>
</ac:structured-macro>

The blueprint module complete key is specified and therefore the correct blueprint wizard wizards is selected if a user clicks on the button.

If you create the button by hand, it looks like this:

Code Block
languagexml
<ac:structured-macro ac:name="create-from-template">
  <ac:parameter ac:name="blueprintModuleCompleteKey">de.smartics.atlassian.confluence.smartics-projectdoc-confluence-space-devdiary:projectdoc-blueprint-doctype-todo</ac:parameter>
  <ac:parameter ac:name="contentBlueprintId">798abbd6-0c5c-4c77-ab8d-29514419e910</ac:parameter>
  <ac:parameter ac:name="templateName">798abbd6-0c5c-4c77-ab8d-29514419e910</ac:parameter>
  <ac:parameter ac:name="createResult">edit</ac:parameter>
  <ac:parameter ac:name="buttonLabel">Create Todo</ac:parameter>
</ac:structured-macro>

Confluence adds the content blueprint ID and the template name by their instance ID. This seems to make it possible for the Create-from-Template Macro to show the correct Blueprint blueprint also in the editor. Since we do not know these instance IDs at the time of writing the doctype, we cannot add them.

We are working on improving the user experience on this, but currently there is no better solution to this.

Section
titleCopy and Paste Issue
Section
titleThe Problem

If you move or copy a page with e Create-from-Template Macro from one space to another, you may – sooner or later – notice, that pages you create are still stored on the original space.

This is because the parameter Space key is set by default to the key of the space the page has been created at originally.

This is a bit annoying because this issue is not easy to catch.

Section
titleRecommendation

New versions of the doctype add-ons will leave that parameter blank. But if you use older versions – which includes using pages that have been created with older versions – this issue still applies.

  1. Use the homepage blueprint wizards to create new homepages in a site.
    1. Filter homepage blueprint wizards by typing "homepage"
    2. Select the type of homepage to create
      Select the type of homepage you want to create
  2. If you happen to copy a page from one space to another, check for Create-from-Template buttons and remove the value from the Space key parameter (if there is one) or set it to a space you intend to write to
    1. Please note that the buttons may not be visible if they are part of a Section Macro that ignores the button and is not shown if there is no other content
    2. Note that this relevant on moving/copying hompages of every doctypes as well as other document instances

...