Fetch jcr:created from cq:page | Community
Skip to main content
tushaar_srivastava
Level 6
January 31, 2020
Solved

Fetch jcr:created from cq:page

  • January 31, 2020
  • 1 reply
  • 2660 views

Hi,

We need to fetch the jcr:created date for cq:Page (TestTouchRTE).

I am using 

<c:set var="createdDate" value="${pageProperties['jcr:created']}"/>

This is giving jcr:content created date i.e. of cq:PageContent

 

, instead I want the jcr:created date of cq:Page.

 

Thanks

 

 

@kautuk_sahni @arunpatidar 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Actually it should not make any difference, and I wonder how in your case the timestamps can be different at all.

 

But the Page API does not provide any way to read that (I see a "getLastModified()" method, but no "getCreated()" method, which is a bit inconsistent), therefor I would stick with the method you already have. As said, I cannot explain the inconsistency, but this property is not protected, and thus can be changed at will.

1 reply

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
January 31, 2020

Actually it should not make any difference, and I wonder how in your case the timestamps can be different at all.

 

But the Page API does not provide any way to read that (I see a "getLastModified()" method, but no "getCreated()" method, which is a bit inconsistent), therefor I would stick with the method you already have. As said, I cannot explain the inconsistency, but this property is not protected, and thus can be changed at will.

patrickw9740541
February 16, 2023

Hi,

 

jcr:created is different on publish. The one on cq:page is correct whereas the one cq:PageContent is the same as date modified. I also need this as I'm trying to work out when it was first published and then subsequently changed. Simple you would think.

joerghoh
Adobe Employee
Adobe Employee
February 18, 2023

On publish the properties do not necessary contain the values you would expect. And also the values of the various time-related properties (e.g. jcr:created, cq:lastModified, cq:lastReplicated) is not defined. That means that the jcr:created property on the cq:Page node will be different on publish compared to the author.

 

If you need want to capture the time the page was created on author and have the same value available on publish, I would recommend to use a custom property which has exact this semantic.