Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Edited

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

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
 

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!



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?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.6.2
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,622 views 7 30
Read article

Community Events

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

Events near you