Workflows are some of the most powerful tools in the toolbox of any AEM developer, however, due to some questionable UI choices in the TouchUI, they are somewhat buried. To understand why, let's take a look at the process for starting a workflow from the AEM Assets console:
Which of course leaves our authors wondering...
Naturally, we have the option to just deal with the usability challenge and address it with author training, but what if you wanted to extensively use workflows? Making authors use a hard to find feature is going to impinge adoption so how can you improve the user experience without extensively customizing the AEM UI?
Sling Resource Merger
You'll notice that the AEM UI components show up under the path /mnt/overlay[path], which means they are actually generated by Sling Resource Merger. This Apache Sling feature generates a merged set of resources based on multiple source paths, in the example of the AEM Assets UI, combining the paths:
As with most AEM / Sling functionality, Resources under /apps will take precedence over resources under /libs, thus enabling a clean way to override the default AEM UI without making any modifications of /libs.
NOTE: Any modification / override will need to be maintained, so keep in mind that during an upgrade the node structure, resource types or attributes may change so keep that in mind when deciding whether or not to overlay a default feature.
Step 1: Add the Workflow Action
To push the workflow button up in the selections action list, you can copy:
and then update the sling:resourceType AND variant attributes to display as a regular action instead of a sub-action.
Step 2: Order the Workflow Action
By default the new workflow action will be put at the end of the action bar, so let's have Sling Resource Merger insert the action between before some of the other actions. For example to place the Workflow button before the Extract Archive button, add the attribute: sling:orderBefore="extractarchive". When you refresh the Assets UI, you can now see that the button is now directly following the create button:
Step 3: Hide Create > Workflow
Since we don't want the same action to be available in multiple places, we can hide the original button by adding a node at:
with the property sling:hideResource=true
Additionally, to prevent the create button from shifting to the last position, we need to set sling:orderBefore="startworkflow" on the node:
Try It Yourself
I've created a ready to go package if you wanted to try the tweak yourself. As noted above, you will need to check across AEM versions. I've tested it on 6.4 and 6.5, but even between those versions the icon for workflow has changed.
Download the Package
I hope this helps you understand how you can use Sling Resource Merger to tweak the AEM UI as well as having some ideas of what impact this can have on your upgrade process.