4 Replies Latest reply on Oct 12, 2017 1:45 PM by Jörg Hoh

    cq:lastReplicated date available on publish

    minisanu Level 1

      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. Re: cq:lastReplicated date available on publish
          mallik0718 Level 1

          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.

          • 2. Re: cq:lastReplicated date available on publish
            digitalect-expert

            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.

            • 3. Re: cq:lastReplicated date available on publish
              mallik0718 Level 1

              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.

              • 4. Re: cq:lastReplicated date available on publish
                Jörg Hoh Adobe Employee

                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