Hi Team,
Is it possible to get a replication action from triggered workflow (activate page/assets model or activation model).
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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-b...
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/replicat...
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-b...
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/replicat...
@AEMLearner-1989 : Yes it possible to do this but there are multiple ways to it.
thanks.
To implement a replication action from a triggered workflow in Adobe Experience Manager (AEM), such as activating pages or assets, you will need to configure and customize your workflows accordingly. In AEM, replication is the process of making content available on Publish instances after it has been worked on in an Author instance. Workflows can be set up to include replication steps that automate this process when certain conditions are met, like the approval of a page or asset.
In AEM, the Request for Activation workflow is one such workflow that can be customized to include a replication step. This workflow is typically used for publishing pages within AEM Sites and is automatically triggered when a content author attempts to publish content but does not have the appropriate replication rights. To customize this behavior, you can overlay the workflow model and update related configurations and scripts as required. Here is a step-by-step process to customize the Request for Activation workflow for replication:
For more information on customizing the workflow for replication actions, please refer to the following AEM documentation:
Moreover, when developing custom workflows or steps that involve replication, you can utilize AEM's Replication API. This API allows you to programmatically perform replication actions within your custom workflow steps. The following documentation provides detailed information on using the Replication API:
@AEMLearner-1989 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes