How to display the (comala) publication date of a page using a macro?
Asked by Andreas Schwab:

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?


Answers:
author: Jorge Merino
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/109511iCB3A1A0F0D2C549E/image-dimensions/459x384?v=v2 "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](https://community.atlassian.com/t5/image/serverpage/image-id/109513i466A3A9856F91553/image-dimensions/373x214?v=v2 "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  

comments: author: Andreas Schwab
body: 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!  

<br />

<br />


author: Marlene Pirker
body: 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?


author: James Conway
body: Hi [@Marlene Pirker](/t5/user/viewprofilepage/user-id/4394046)

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


Tags: confluence-server

header

metadata

server