Detailed information about createpage*.action

Hi

I’d like to write a macro that creates a page from a template and adds a dynamically generated label.

Now I know that “createpage.Action” uses “labelsString” and adds a label to the new page, but it ignores “templateId”. The opposite if I use “createpage-entervariables.Action”. In this case, “templateId” is used and the site uses the given template, but “labelsString” is ignored.

Adding the label to the template is not an option, because the label is one part fixed text (moderated_by_) and another part dynamically generated with “$Action.remoteUser.Name”.

Is there a more detailed documentation about that or even better: How can I create a page from a given template and add automatically the label with this Information?

Any help would be appreciated.

Thanks a lot and best regards
Klaus

Hi, I haven’t worked a lot with tempates/blueprints so I can give you only hints…

First of all take a look at the rest API https://docs.atlassian.com/atlassian-confluence/REST/latest. They have both content and templates section. You might be able to do what you need to do just by calling rest methods.

Another option would be to parse the template/blueprint into storage format and call the PageManager to create page and the LabelManager to add label(s).

Edit: If there is some pattern in page creation, e.g. all pages within that specific space must have the label pattern you mention before, then you can just listen for page create event and if event fits your criteria then add the label using the LabelManager

Hi

Thank you very much! I’ll take a deeper look at that. I’m fairly new at this so I need some time to figure it out.

Thanks!

Sure, no problem. Just post new question with relevant code to give hints away :slight_smile: