Hello I have a relatively simple user macro to set some page properties, sadly it stoped working whith the upgrade to Confluence 7.4 and the macro test is just displayed on the confluence page without being evaluated at all. Maybe anyone here has an idea what changed from confluence 6.15 to 7.4 that can break this code so badly... :/
## Macro title:
## Macro has a body: Y
## Body processing: None
## Output: None
## Developed by: Moritz Wagner
## Date created: dd/mm/yyyy
## Installed by: My Name
## @param Template:title=Template|type=string|required=true|desc=The template this document is based on
## @param Version:title=Template version|type=string|required=true|desc=The Version of this Template
## @param Valid:title=Template valid since|type=date|required=true|desc=The date since this template version is valid
#set ( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )
#set ( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )
#set ( $containerManager=$getInstanceMethod.invoke(null,null) )
#set ( $containerContext=$containerManager.containerContext )
#set ( $contentPropertyManager=$containerContext.getComponent('contentPropertyManager') )
$contentPropertyManager.setTextProperty($content, "templateInfo.title", $paramTemplate)
$contentPropertyManager.setTextProperty($content, "templateInfo.version", $paramVersion)
$contentPropertyManager.setTextProperty($content, "templateInfo.valid", $paramValid)
$contentPropertyManager.setTextProperty($content, "templateInfo.ticketNb", $body)
Thanks very much in advance,
I had the same issue and found some helpful information in the developer community:
You can use the $content.getProperties() and don't have to use the ContentPropertyManager anymore.
#set ( $props = $content.getProperties() )
#set ( $newProps = $props.setStringProperty("templateInfo.title", $paramTemplate) )
Thank you Dominic, I'm also having this problem however I believe Moritz and I are using:
So this solution doesn't appear to work (at least for me). I'm unable to access the data previously saved with the ContentPropertyManager and the setTextProperty method.
Any chance you have any other suggestions or could point us in another direction?
What error do you get and what confluence version do you use?
I would have said that it does not matter if you take string or text. You just have to take always the same :)
you will get a "ContentProperties" Class.
There you can use getTextProperty or getStringProperty.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events