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,
Moritz
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) )
Regards, Dominic
Thank you Dominic, I'm also having this problem however I believe Moritz and I are using:
setTextProperty
Not:
setStringProperty
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dominic,
Hi Blake,
for me the supposed version works flawless, thank you so much for this quick fix, that saved me hours of searching!!
Have a good Day,
Moritz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
With
$content.getProperties()
you will get a "ContentProperties" Class.
There you can use getTextProperty or getStringProperty.
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.