Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 1

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

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

5 Replies

Avatar

Community Advisor

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

Avatar

Level 1

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!

 

 

Avatar

Correct answer by
Community Advisor

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

Avatar

Community Advisor

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

Avatar

Administrator

@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