Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

cq:lastReplicated date available on publish

Avatar

Level 4

Hi Everyone,

We are dynamically fetching values from one page to another. Based on the cq:lastReplicatedDate  of one page we are doing a sorting and showing up the details on another page.If cq:lastReplicated is not there , then the values will not be sorted and we will not get details on another page.

We need the cq:lastReplicatedDate in publish environment also.How can we achieve this. We know cq:lastReplicatedDAte will not available in publish,but how can we resolve this issue?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

the cq:lastReplicated will be created/updated on author after the replication has happened. That also means, every property "cq:lastReplicated" you see on publish shows the replication date of the last replication; that would typically render it useless for your purpose.

If you really want to have such a property, I see 2 options:

1) Create a listener on publish which sets the current date as "lastChanged" property whenever the page changes. This works under the assumption, that pages on publish are only changed when they are replicated.

2) If you run replication already in a workflow, add a dedicated workflow step which adds the current time as "replicationDate" to the page. It might not be accurate, but when you only need relative order of pages it should work.

In both cases you now have a date, which is written under clearly defined circumstances you control. Relying on properties maintained by the produt itself will not give you this confidence.

Jörg

View solution in original post

6 Replies

Avatar

Level 4

The publish environment does not have cq:lastReplicated property. The equivalent property on a page that you would get to see on publish instance is, jcr:created. This property gets updated every time a page is published. So, technically jcr:created property's value in publish instance and cq:lastReplicated value in author instance will almost always identical. See if you can use either of these properties based on your WCM mode(author/publish) to sort the values.

Avatar

Former Community Member

You can use jcr:created if the page is newly created i.e. the page was not available but after replication it is created/made avaialble. And if the page is already available, then you can use cq:lastModified property. This will serve the purpose.

Thanks.

Avatar

Level 4

I agree. But there is a catch, jcr:created property gets updated for every publish(regardless of the modifications to the page) where as cq:lastModified property will be updated only when the page is modified. A mere publish without modifying the page will not update cq:lastModified but it does update jcr:created property. So, either of those can be used for sorting the articles.

Avatar

Correct answer by
Employee Advisor

Hi,

the cq:lastReplicated will be created/updated on author after the replication has happened. That also means, every property "cq:lastReplicated" you see on publish shows the replication date of the last replication; that would typically render it useless for your purpose.

If you really want to have such a property, I see 2 options:

1) Create a listener on publish which sets the current date as "lastChanged" property whenever the page changes. This works under the assumption, that pages on publish are only changed when they are replicated.

2) If you run replication already in a workflow, add a dedicated workflow step which adds the current time as "replicationDate" to the page. It might not be accurate, but when you only need relative order of pages it should work.

In both cases you now have a date, which is written under clearly defined circumstances you control. Relying on properties maintained by the produt itself will not give you this confidence.

Jörg

Avatar

Level 4

Thanks Jorg.Sorry for the delayed response.

Avatar

Level 1

Hi,

We have Dev environment (AEM 6.5 with SP 6.5.9) with shared Data storage and we see properties "cq:lastReplicated", "cq:lastReplicatedBy" and "cq:lastReplicationAction" are getting created in Publish instance as well. Is it because of shared Data storage setup between Author and Publish instances?