Approach to implement content preview environment in Adobe Experience Manager(AEM)
By default Adobe Experience Manager(AEM) not provides the preview instance to preview the content before publishing to live environment but most of the cases preview is required before publishing the content to live environment.
This post explain the approach to preview and approve the content before publishing to live environment.
The below diagram explains the preview flow
- Author creates the content in production author and start the workflow
- Workflow sends the content to Stage author and Publishers
- Workflow assign the task to approver group and send the notification email
- Approver reviews the content in stage environment and approve or reject the content (workflow)t - provides the detailed information for rejection
- if the content is approved
- Workflow sends the approved content to production publishers.
- If the content is rejected
- Workflow assign the task to author and sends the notification
- Author review the details and completes the workflow
- Start the process again by correcting the content
Define Replication process step with ECMA script:
Create ecma file replicate.ecma under /etc/workflow/scripts/<<application>> e.g. /etc/workflow/scripts/blog - This ecma script helps to replicate the content to stage environments
var workflowData = workItem.getWorkflowData();
var path = workflowData.getPayload().toString();
var session = workflowSession.getSession();
var replicator = sling.getService(Packages.com.day.cq.replication.Replicator);
var options = new Packages.com.day.cq.replication.ReplicationOptions();
for(var i=0;i<args.length;i++) {
var agent= args[i];
var filter = new Packages.com.day.cq.replication.AgentIdFilter(agent);
options.setFilter(filter);
options.setSuppressStatusUpdate(true);
try {
replicator.replicate(session, Packages.com.day.cq.replication.ReplicationActionType.ACTIVATE, path, options);
} catch(e) {
log.error("Cannot replicate page : " + path +"on publisher. (agentId: " + agent + "): " + e);
}
}