Wednesday, 3 January 2018

AEM workflow Best Practices

From Brendan Robert :

Workflow is not the same as bulk process automation.

So rule #1: Do not use workflow to automate activities that do not involve user interaction.  DAM Update Asset breaks this rule and we've all paid dearly for that.


Rule #2: Keep it simple.  Don't use nested splits.  The engine can handle it but the UI can't and will break when you try to edit it later.


Rule #3: If you want testable code only use Java extensions, not ECMA scripts.  There's no easy way to debug ECMA workflow scripts so if it's more than 1 or 2 lines you're going to have a rough ride getting it to work.


Rule #4: Clean up.  Do not neglect workflow purge activities.  Because of how sling eventing works you will gum up the works leaving old/expired/aborted workflow instances piling up.


Rule #5: Don't try to make workflows run parallel to each other when they are working with the same assets/folders/projects.  It's just a recipe for disaster and misery.  See also: Rule #2.