Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Not able to get correct result for published page as the draft pages are also having 'cq:lastReplicated' & 'cq:lastReplicationAction' properties from the templates

abhi614
Level 2
Level 2

Hi All,

 

I am trying to get the result of pages which are published in author instance. But I am not able to get the correct results as newly created pages from a published template is taking 'cq:lastReplicated' & 'cq:lastReplicationAction' properties from the template. So even if we are not publishing that newly created page, we are seeing these properties being added in the jcr:content from the template as the template was already published. 

 

Can anyone please help on this how we can remove these properties from newly created pages/ draft pages which hasn't been published?

1 Accepted Solution
Jörg_Hoh
Correct answer by
Employee
Employee

Please do not read these properties directly, as technically they are an implementation detail. 

Rather do something like this:

ReplicationStatus status = page.adaptTo(ReplicationStatus.class);
if (status.getAvailableAgents("preview")) {
  // status available for preview
  boolean canBeViewedOnPreview = status.getStatusForAgent("preview").isActivated();
}

(https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/day/cq/replication/ReplicationStatus.htm...)

 

 

View solution in original post

5 Replies
Pawan_Gupta_
Community Advisor
Community Advisor

Hello,

 

Can you check if one of below property helps you there??

 

cq:lastReplicated_publish
cq:lastReplicatedBy_publish

 

Thanks!!

abhi614
Level 2
Level 2

hi Pawan,

 

Thanks for the suggestion but I am not seeing these properties in the page jcr:content. I am generating the result in author and not from the publish environment. I have to get the list of pages which are activated/published from the authors. So while doing so, I am getting those pages also in the list which are newly created and not activated/published. This is because its taking the lastreplicated property from the template used for creating the page.

 

Thanks & Regards,

Abhishek

Pawan_Gupta_
Community Advisor
Community Advisor

Hi Abhishek,

 

I think you answer the question. if those properties are not available then you can use that as condition to know the pages which are not published because when you publish pages, these two properties should populate corresponding values.

 

I hope you understand it now.

 

Thanks!!

Jörg_Hoh
Correct answer by
Employee
Employee

Please do not read these properties directly, as technically they are an implementation detail. 

Rather do something like this:

ReplicationStatus status = page.adaptTo(ReplicationStatus.class);
if (status.getAvailableAgents("preview")) {
  // status available for preview
  boolean canBeViewedOnPreview = status.getStatusForAgent("preview").isActivated();
}

(https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/day/cq/replication/ReplicationStatus.htm...)

 

 

Pawan_Gupta_
Community Advisor
Community Advisor

Thanks for adding that, i think i missed mentioning. My intention about sharing those properties to mainly query from AEM console to find out those pages from authoring/local search into site path.