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

How to create an AEM component using Reactjs

In this tutorial, I will show how to use use Adobe's archetype to create an AEM application with React.js support and also how to add a new React.js component so that it can be added into a page, above is the vid and below you will find some useful notes. In the second part we will see how to configure the Sling Model for the AEM React component. 1. Pre-reqs Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or newer. Have Maven installed, understand how it works and also understand how to use Adobe's archetype, you can watch my video about maven here: Creating an AEM application using Maven and Adobe's archetype 2.

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