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

JCR SQL2 Query pages sorted by published date.

alvarof55440963
Level 2
Level 2

Hi there. Right now I'm working on a component that will display a list of pages, sorted by the date. To do the sort I used the jcr:createdDate but the client is actually looking for a sort based on published date. That means that the articles that were published in AEM earlier in time will be shown before on the list. I have published some pages and checked the CRX to see if I get a property like jcr: publishedDate, but doesn't seem to include one. Is there a way to actually do that?

Thanks

1 Accepted Solution
Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

Sort on 'cq:lastReplicated' date in the SQL query

cq:lastReplicated = published date

In addition to that, you should check if  'cq:lastReplicationAction' = 'Activate'  in the query to pull only published items and filtering out 'Deactivated' items.

View solution in original post

2 Replies
Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

Sort on 'cq:lastReplicated' date in the SQL query

cq:lastReplicated = published date

In addition to that, you should check if  'cq:lastReplicationAction' = 'Activate'  in the query to pull only published items and filtering out 'Deactivated' items.

alvarof55440963
Level 2
Level 2

Totally. Thanks. And I can use last replicated action to check if publish or unpublished.