In today’s world, most of the developers try to find the delta content manually in AEM by checking the timestamp of pages and assets and add these paths in the filers of AEM package. Though its not an incorrect way, but there are high chances of missing some pages or assets doing so. So, we have curated this article to help AEM developers find the pages and assets that has been created/modified during specific given time frame and automates the package creation process.
The AEM Groovy Console provides an interface for running Groovy scripts in Adobe Experience Manager. Scripts can be created and executed to manipulate content in the JCR, call OSGi services, or execute adhoc code using the AEM, Sling, or JCR APIs without any interruptions to AEM instance.
If you have ever come across a situation where in you need to create delta content packages in AEM instances, then this blog is for you. We are going to create and execute a groovy script which creates a series of content packages in package manager, which are modified or created over a specific date range.
Download and install the groovy console package, which is compatible with your AEM version. Below table shows the compatibility versions of AEM and Groovy Console.
In order to find the delta content for a specific date range, we are going to use SQL2 query and find out if any new pages or assets have been created or any existing pages and assets have been modified in AEM instance. We are going to utilize the JCR properties like jcr:created and cq:lastModified in our SQL2 query.
Sample SQL2 Query:
SELECT * FROM [cq:PageContent] AS s WHERE ISDESCENDANTNODE([/content/nextrow]) AND ((s.[cq:lastModified] >= CAST(‘2020-07-28T16:00:00.000Z’ AS DATE) AND s.[cq:lastModified] <= CAST(‘2020-07-30T21:00:00.000Z’ AS DATE)) OR (s.[jcr:created] >= CAST(‘2020-07-28T16:00:00.000Z’ AS DATE) AND s.[jcr:created] <= CAST(‘2020-07-30T21:00:00.000Z’ AS DATE))) order by [cq:lastModified]
Read Full Blog
Please use this thread to ask the related questions.