AEM 6 - Classic UI Starting Workflow From Asset Editor


This post is for AEM users who wish to Start Workflow on assets from Asset Editor after adding or modifying metadata

Demo | Package Install

Starting a Workflow

If the Asset is already in Workflow


1) Login to CRXDE Lite (http://localhost:4502/crx/de) and create folder /apps/asset-editor-start-workflow

2) Create node /apps/asset-editor-start-workflow/clientlib of type cq:ClientLibraryFolder and add a String property categories with value cq.dam.admin

3) Create file (nt:file) /apps/asset-editor-start-workflow/clientlib/js.txt and add


4) Create file (nt:file) /apps/asset-editor-start-workflow/clientlib/add-workflow.js and add the following code. The dialog config for workflow was copied from \libs\cq\ui\widgets\source\widgets\wcm\SiteAdmin.Actions.js

    var isAlreadyInWorkflow = function(pagePath){
        var url = CQ.HTTP.noCaching("/bin/workflow.json");
        url = CQ.HTTP.addParameter(url, "isInWorkflow", pagePath);
        url = CQ.HTTP.addParameter(url, "_charset_", "UTF-8");

        var response = CQ.HTTP.get(url);
        var isInWorkflow = false;

        if (CQ.HTTP.isOk(response)) {
            var data = CQ.Util.eval(response);
            isInWorkflow = data.status;

        return  isInWorkflow;

    var showWorkflowDialog = function(pagePath){
        var id = CQ.Util.createId("cq-workflowdialog");

        //this dialog config was copied from \libs\cq\ui\widgets\source\widgets\wcm\SiteAdmin.Actions.js
        var startWorkflowDialog = {
            "jcr:primaryType": "cq:Dialog",
            "title":CQ.I18n.getMessage("Start Workflow"),
            "id": id,
            "params": {
            "items": {
                "jcr:primaryType": "cq:Panel",
                "items": {
                    "jcr:primaryType": "cq:WidgetCollection",
                    "model": {
                        "id": id + "-model",
                        "title":CQ.I18n.getMessage("Available Workflows"),
                            "baseParams": { tags: 'wcm' },
                                [ {"name":"wid"}, {"name":"label"}, {"name": CQ.shared.XSS.getXSSPropertyName("label")} ]
                        "tpl": new CQ.Ext.XTemplate(
                            '<tpl for=".">',
                            '<div class="x-combo-list-item">',
                            '{[CQ.I18n.getVarMessage(CQ.shared.XSS.getXSSTablePropertyValue(values, \"label\"))]}',
                    "comment": {
                        "jcr:primaryType": "cq:TextArea",
                    "title": {
                        xtype: 'textfield',
                        fieldLabel:CQ.I18n.getMessage('Workflow Title')

        var dialog = CQ.WCM.getDialog(startWorkflowDialog);

        dialog.addHidden({ "payload": pagePath } );

        dialog.success = function(){
            CQ.Ext.Msg.alert("Workflow","Workflow started on asset - " + pagePath);

    var addWorkflowButton = function(bbar, pagePath){
        var wButton = new CQ.Ext.Button({
            "text": "Start Workflow",
            "cls": "cq-btn-save",
            "handler": function() {
                var isInWorkflow = isAlreadyInWorkflow(pagePath);

                if (isInWorkflow) {
                    CQ.Ext.Msg.alert("Workflow", CQ.I18n.getMessage("Asset is already subject to a workflow!"));


        bbar.insertButton(1, wButton);

    var INTERVAL = setInterval(function(){
        var tabPanel = CQ.Ext.getCmp("cq-damadmin-tabpanel");


            tabPanel.on("add", function(t, assetEditor){
                addWorkflowButton(assetEditor.formPanel.getBottomToolbar(), assetEditor.path);
    }, 250);


  1. Hi,
    there is also a way to add the complete button near it?

    Tank you for any suggestions.

  2. Hi, Editing DAM Asset redirected to Touch UI edit mode
    In classic mode
    1) As an author, route a DAM Asset for workflow.
    2) As approver, try to edit the content of the DAM asset routed in step 1.
    Expected: Approver should be navigated to Classic UI edit mode.
    Actual: Approver is routed to Touch UI edit mode
    Please provide suggestions for this.