Replication action from workflow
Hi Team,
Is it possible to get a replication action from triggered workflow (activate page/assets model or activation model).
Hi Team,
Is it possible to get a replication action from triggered workflow (activate page/assets model or activation model).
Yes, it is possible to get a replication action from a triggered workflow. When a workflow is triggered to activate a page or asset, it goes through a series of steps, including replication.
To get the replication action from the workflow, you can use the Workflow API provided by AEM.
you can retrieve the replication action from a workflow:
import com.adobe.granite.workflow.Workflow;
import com.adobe.granite.workflow.WorkflowData;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowExecutionContext;
import com.adobe.granite.workflow.metadata.MetaDataMap;
public class ReplicationActionWorkflowProcess implements WorkflowProcess {
@Override
public void execute(WorkItem workItem, WorkflowExecutionContext context, MetaDataMap args) throws WorkflowException {
WorkflowData workflowData = workItem.getWorkflowData();
String payloadPath = workflowData.getPayload().toString();
// Check if the payload is a page or asset
if (payloadPath.startsWith("/content/dam")) {
// Get the replication action from the workflow metadata
String replicationAction = workflowData.getMetaDataMap().get("replicationAction", String.class);
// Do something with the replication action
if (replicationAction != null) {
// Perform specific actions based on the replication action
if (replicationAction.equals("Activate")) {
// Handle activate action
} else if (replicationAction.equals("Deactivate")) {
// Handle deactivate action
}
}
}
}
}
https://adobe-consulting-services.github.io/acs-aem-commons/features/workflow-processes/replicated-by-workflow-initiator/index.html
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/replication.html?lang=en
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.