How can I show the Comala Workflows status in a Confluence User Macro
Asked by John W_ Machar:

We have a Confluence User Macro which presents information about a page and its descendants in a table. The attributes for each page are inserted into cells in a row of the HTML table as Confluence macros e.g.,

```
<td>?$page.version <\td>
<td> $page.lastModifier.name </td>
```

I want to add a new column containing the Comala Workflow status of the page (as both icon and text) eg.:

![image.png](/t5/image/serverpage/image-id/209278i0F2AF3551BC68DC3/image-size/large?v=v2&px=999 "image.png")

This way I can easily see if the parent page and descendants are all Published. I cannot figure out how to get at the Comala pagestatus information from the Confluence user macro. The Document Report macro isn't what I want. I just want to add the page status to the existing table .

Does anyone have any suggestions for how to insert a page's Comala workflow status into the table cell?

Thanks in advance.


Answers:
author: John W_ Machar
body: Followup: I contacted the folks at Comala who said they didn't support integration of Comala Document Management with user macros. They did however suggest I look at the following:

[Using a CQL filter in the document-state-report macro to report on grandchildren of a page](https://comalatech.jira.com/servicedesk/customer/portal/1/SUPPORT-15069)

I found that I could use the **document-state-report** macro and use a *CQL filter* of

**ancestor** =pageid OR **id**=pageid

to include the root (index) page as well as descendant pages.

However there were a few issues still remaining:

1. The page order is not the hierarchical one, although various columns can be sorted.
2. When I included a **last final version** column it was only populated if the page had been approved at some time, otherwise the entry was blank. When populated it showed the last ++approved++ version, not the current version. They have a ticket to fix this.
3. The biggest issue was when I used Space Tools \> Content Tools \> Export to produce a single PDF of the whole page tree from the root downwards. In this case the table rendered on-screen was not reproduced in the PDF file. Instead the placeholder text  

   Comala Document Management add-on...  

   appeared in its place.  

   I could do *Print* in the browser and select *Microsoft Print to PDF* as the printer, as that does render the Comala macro correctly, Then I could use Space Tools to export the descendant pages as a second PDF file and then stitch the two together. However this is a bit of a hassle when the aim was to easily and quickly produce a single PDF I could archive.

Hopefully this is useful to others.

Best regards,

--JWM


author: Bill Bailey
body: Hello [@John W_ Machar](/t5/user/viewprofilepage/user-id/3923700) , yes this type of thing can often be challenging. First, that object has to be exposed in the Velocity context (many are not) and then second, you have to figure correct reference.

So first, I will share something that has worked with Scroll (K15t) products:
> ## ContentPropertyManager setup  
> #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'))
>
> ....
>
> #set($fileName=$contentPropertyManager.getTextProperty($content, "metadata.scroll.pagetitle"))

So something like:
> #set($pageStatu$contentPropertyManager.getTextProperty($content, "`metadata.properties.comalaworkflows.`currentState"))

Or
> #set($pageStatu$contentPropertyManager.getTextProperty($content, "`metadata.comalaworkflows.`currentState"))

You can try to play with this. The Comala people are pretty friendly, so you may want to file a case with them.

comments: author: Bill Bailey
body: BTW, you say you are on Confluence Cloud, but user macros are not available on the cloud. I assume that is in error?


author: John W_ Machar
body: Bill, thanks for the reply. I will try this out. I was hoping there was some simple thing I hadn't managed to discover.

We are using the server edition but I couldn't select that when creating the request. I figured that the user macro information would be the same in each case so just went with one of the allowed options.

Best regards,

--JWM


Tags: cloud

comala

confluence-cloud

user-macro