Ir al contenido principal

Create a custom AEM workflow process step with a dialog

In this tutorial I talk about how to create a custom workflow step process with an additional dialog for configuring it, above is the vid and below you will find some useful notes.
  1. 1.


  2. 2.

    What is an AEM Workflow and workflow model

    • Workflows allow you to automate different tasks inside AEM by defining a sequence of steps to be executed and the actions to be performed at each step.
    • A workflow model represents the definition of a workflow using nodes for the steps or actions to be executed and transitions to define how the steps are organized and what is going to be the execution sequence
  3. 3.

    Creating the base app with the custom workflow step

    • Create the app using adobe's archetype
      mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate "-DarchetypeGroupId=com.adobe.granite.archetypes" "-DarchetypeArtifactId=aem-project-archetype" "-DarchetypeVersion=20" "-DarchetypeCatalog=" "-DgroupId=co.dlighthouse.aem.workflowstepdialog" "-DartifactId=aem-workflow-step-dialog" "-Dversion=0.1.0-SNAPSHOT" "-Dpackage=co.dlighthouse.aem.workflowstepdialog" "-DappsFolderName=workflow-step-dialog" "-DconfFolderName=workflow-step-dialog" "-DartifactName=Workflow Step Dialog" "-DcomponentGroupName=Workflow Step Dialog" "-DcontentFolderName=workflow-step-dialog" "-DcssId=workflow-step-dialog" "-DpackageGroup=workflow-step-dialog" "-DsiteName=Workflow Step Dialog" “-DoptionIncludeExamples=n” “-DoptionIncludeFrontendModule=n” “-DoptionAemVersion=6.5.0”
    • Use the yeoman generator and create the custom workflow step, you can also check the code on github or do it by hand.
      npm install -g yo
      npm install -g generator-aem-application
      cd aem-workflow-step-dialog
      yo aem-application:workflow workflowName="Sample Application - Sample Workflow Process Step" componentParentPath=workflow-step-dialog/components/workflow componentNodeName=workflow-process javaRootPackageName=co.dlighthouse.aem.workflowstepdialog.core javaWorkflowClassName=SampleWorkflowProcess
    • For the dialog for the custom workflow step component we need the following:
      Component node (.content.xml)
      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:sling="" xmlns:cq="" xmlns:jcr=""
          jcr:title="Sample Application - Sample Workflow Process Step"
      cq:EditConfig node (_cq_editConfig.xml)
      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:cq="" xmlns:jcr="" xmlns:nt=""
              jcr:title="Sample Application - Sample Workflow Process Step"
      Touch UI dialog cq:dialog node (_cq_dialog/.content.xml)
      <?xml version="1.0" encoding="UTF-8"?>
      <jcr:root xmlns:sling="" xmlns:cq="" xmlns:jcr="" xmlns:nt=""
          jcr:title="Sample Application - Sample Workflow Process Step Properties"
              <items jcr:primaryType="nt:unstructured">
                      <items jcr:primaryType="nt:unstructured">
                              fieldLabel="Something Important"
    • We need the class that implements WorkflowProcess and overrides the execute method.
      package co.dlighthouse.aem.workflowstepdialog.core.workflows;
      import com.adobe.granite.workflow.WorkflowException;
      import com.adobe.granite.workflow.WorkflowSession;
      import com.adobe.granite.workflow.exec.WorkItem;
      import com.adobe.granite.workflow.exec.WorkflowData;
      import com.adobe.granite.workflow.exec.WorkflowProcess;
      import com.adobe.granite.workflow.metadata.MetaDataMap;
      import org.apache.commons.lang3.StringUtils;
      import org.osgi.service.component.annotations.Component;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
          property = {"process.label=Sample Application - Sample Workflow Process Step"}
      public class SampleWorkflowProcess implements WorkflowProcess {
          private static final Logger log = LoggerFactory.getLogger(SampleWorkflowProcess.class);
          public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {
              final WorkflowData workflowData = workItem.getWorkflowData();
              final String type = workflowData.getPayloadType();
              // Check if the payload is a path in the JCR; The other (less common) type is JCR_UUID
              if (!StringUtils.equals(type, "JCR_PATH")) {
              // Get the path to the JCR resource from the payload
              final String path = workflowData.getPayload().toString();
              String somethingImportant = args.get("somethingImportant", "not set");
    "Sample Application - Sample Workflow Process Step - somethingImportant: {} - payload: {}", somethingImportant, path);
    • Finally build and deploy your new app into AEM
      mvn clean install -PautoInstallPackage -Padobe-public
  4. 4.


Entradas populares de este blog

Creating Docker containers for Adobe Experience Manager

This is a Docker tutorial for creating a docker image for the Galen framework, above is the vid and below you will find some of the steps followed. Adobe experience manager is a content management system which in a nutshell is an application that allows us to create web sites to be consumed by end users. You might be familiar with other such applications like wordpress or drupal which serves the same purpose A typical deployment would be comprised of two AEM instances, the author instance used for creating and modifying content, the publish instance which serves the content and finally we have a dispatcher which is a static web server used for caching, load balancing and some security purposes. We can configure an AEM instance to work as an author or publish instance by either changing the file name

Creating a Mongo replicaset using docker: Mongo replicaset + Nodejs + Docker Compose

This is a Docker tutorial for creating a Mongo replica set using docker compose and also a couple more containers to experiment with the replica set, above is the vid and below you will find some of the steps followed. Steps Pre-reqs Have node.js installed And docker installed (make sure you have docker-compose as well) Create a container for defining configurations for a mongo instance Create a container for setting up the replica set Create a simple node app using expressjs and mongoose (A modified version from the previous video ) Create a docker-compose file with the mongo and setup containers and two additional containers for experimenting with the replica set Build, Run and experiment with your new containers Create a dockerfile for the first mongo container (not really needed but you could configure more stuff if needed) Include container with mongo preinstalled:  FROM mongo Create default/working directory:  WORKDIR /usr/src/configs Copy mongo