Is it possible to keep properties such as cq:lastReplicated and cq:lastModified unchanged when updating/modifying a content fragment? | Community
Skip to main content
December 6, 2023
Solved

Is it possible to keep properties such as cq:lastReplicated and cq:lastModified unchanged when updating/modifying a content fragment?

  • December 6, 2023
  • 3 replies
  • 1127 views

Hi,

when working with Content Fragments or Templates and we modify them (as AEM devs), the property cq:lastModified gets updated accordingly after publishing locally.

We then need to make sure that cq:lastReplicated is present and not older than cq:lastModified. This process is conducted manually by developers.

 

Is there a way to have the values of cq:lastModified and cq:lastReplicated to change, but only when editors make updates (last modified) and push those updates (last replicated)?

 

Thanks,

Tina

 

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 EstebanBustamante

Hey @tina2 

 

So the short answer is NO. cq:lastModified will be updated when changes are pushed, and cq:lastReplicated will change only when you 'activate/publish' a resource. That's the out-of-the-box behavior. However, you could still customize when/what values these properties have on specific events. For example, you could create a workflow step that updates the values of the properties whenever the page or template is 'activated.' You can then create a launcher to listen for when this page/template/resource is activated and execute the custom process step. Another option is to create a replication listener that will do the job.

 

Hope this helps.

 

 

3 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 6, 2023

Hi,

These properties are out of the box, meaning they adhere to specific functionality. If you need them to be dependent on a critical process, the recommendation is to understand how they work before using them or creating new properties that vary according to your requirements.

 

In short, cq:lastModified will be updated with any update, and cq:lastReplicated will be updated once a replication event has been applied to a resource.

 

Hope this helps.

 

https://stackoverflow.com/questions/36642920/jcrlastmodified-vs-cqlastmodified

Esteban Bustamante
Tina2Author
December 6, 2023

Hi Esteban, in truth the question is changed a bit as follows:

 

Is there a way to have the values of cq:lastModified and cq:lastReplicated to change, but only when editors make updates (last modified) and push those updates (last replicated)?

 

instead of having devs to manually update the cq:lastReplicated to a newer one. 

Thanks a lot! 🙂

 

 

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
December 6, 2023

Hey @tina2 

 

So the short answer is NO. cq:lastModified will be updated when changes are pushed, and cq:lastReplicated will change only when you 'activate/publish' a resource. That's the out-of-the-box behavior. However, you could still customize when/what values these properties have on specific events. For example, you could create a workflow step that updates the values of the properties whenever the page or template is 'activated.' You can then create a launcher to listen for when this page/template/resource is activated and execute the custom process step. Another option is to create a replication listener that will do the job.

 

Hope this helps.

 

 

Esteban Bustamante
aanchal-sikka
Community Advisor
Community Advisor
December 7, 2023

Hello @tina2 

 

All facts shared by @estebanbustamante  are correct. 

In general, everyone will discourage you from doing this. In case of content issues, it will become difficult to trace when the modifications were done. Or did the developer forget to replicate stuff after modification.

 

It will only spiral into bigger maintenance issues. Its better that devs replicate the modified  templates and CFM after they have done the edits.

Its more systematic and thus less error prone

Aanchal Sikka
kautuk_sahni
Community Manager
Community Manager
December 11, 2023

@tina2  Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni