Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display the (comala) publication date of a page using a macro?

Andreas Schwab
Contributor
September 7, 2020

We use comala workflows to publish confluence pages. I wrote a little macro to display the publication date.  However, depending on the final page status "Published" I want to derive the actual published date. I do NOT want something like the last modification date as done and working here: 

$action.dateFormatter.formatGivenString($paramMYDATE,$content.getLastModificationDate())

The problem is, I do not know how to fetch the actual publication date, as the modification date is not what I am looking for:

$content.getLastModificationDate()

In the comala workflow definition, I am able to set custom metadata like this.

{set-metadata:approveddate}@datetime@{set-metadata}

And I can use the comala "Get-Metadata" Plugin to fetch the actual value. But I need to fetch the metadata from a common confluence user-macro. 

I want something like:


 $content.getApprovedDate()

(My example does not work...)

Is there any easy method to fix my issue? If not, is there any easy way to display the available methods? 

 

1 answer

0 votes
Jorge Merino
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

Hi!

I would recommend you using the macros included with Comala Workflows (Now called Comala Document Management) set-metadata and get-metadata. Those macros will allow you to save information by using triggers  and retrieve those values in the markup or the page. Because an example makes always easier to understand those concepts please test the following markup:

 

{workflow:name=Simple approval workflow with page header}
{pageheader:visibility=all}
|| Document Status |{pagestatus}|
|| Owner |@creator>fullname@ |
|| Approved By |@First approval>approvers@ |
|| Last reviewer|{get-metadata:name=Last reviewer}|
|| Approval Date/Time |{get-metadata:name=approveddate}|
|| Approval Comment |{get-metadata:name=apcomment}|
{pageheader}
{state:In Progress|approved=Approved|description=Please assign two members of your team|taskable=true}
{approval:First approval|assignable=true}
{state}
{state:Approved|final=true|updated=In Progress|hideselection=true}
{state}
{trigger:pageapproved|approval=First approval}
{set-metadata:approvedby}[~@user@]{set-metadata}
{set-metadata:approveddate}@datetime@{set-metadata}
{set-metadata:apcomment}@approvalcomment@{set-metadata}
{trigger}
{trigger:statechanged|state=Published}
{set-metadata:Last reviewer}[~@user@]{set-metadata}
{trigger}
{workflow}

It will display a page header like this:

pageheaderComala.png

 

In case that you would prefer to retrieve the metadata values directly in your page, for example to use it in page properties table or a page template you could call the get metadata macro:

 

readmetadata.png

 

I hope the example helped you to implement your workflow. Please find below related links in the Comalatech wiki:
https://wiki.comalatech.com/display/CDML/set-metadata+macro

https://wiki.comalatech.com/display/CDML/get-metadata+macro

https://wiki.comalatech.com/display/CDML/Value+References

 

Best regards,
Jorge
 

Andreas Schwab
Contributor
September 9, 2020

Thanks a lot Jorge! 

I think you showed a comala worflow definition. However, I really want to fetch the set metadata from a confluence user-macro. 

E.g. the 

 {set-metadata:approveddate}@datetime@{set-metadata}

Reason for that is that the user-macro currently used is already in place for many pages. I can fetch that easily using the comala "Get Metadata" macro. But this is not what I need. I'll edit my original post for clarification!



Marlene Pirker
Contributor
May 14, 2021

Hi! This really helped me. But I have a problem now: the time zone is the wrong one. Do you know how to change it?

James Conway
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2021

Hi @Marlene Pirker 

I answered your question here:  https://community.atlassian.com/t5/Confluence-questions/Change-Time-Zone-in-Comala-Workflow/qaq-p/1693601

All the best

James
Senior Product Manager

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.6.2
TAGS
AUG Leaders

Atlassian Community Events