Highlighted

Day 14 - AEM Workflows (Part III) | AEM Community Blog Seeding

kautuk_sahni

Community Manager

23-08-2020

BlogImage.jpg

Day 14 - AEM Workflows (Part III) by Red Quark

Abstract

Howdy fellow devs 👋! In the previous two posts, we learned about basics of AEM workflows and examples of Process and Participant steps. In this post, we will cover few other concepts that a programmer usually deals with.

MetaData Map
Sometimes we are faced with a situation where we need to pass data from one workflow step to the another. AEM’s workflow API provides an easy way to achieve this using MetaDataMap.

Please note that only primitive data types like Integer, String etc. can be passed from one step to the another. If you have a requirement to pass non-primitive data then use the byte[] array.

Caution: If the data to be passed is too large, refrain passing InputStream. Instead, a better approach is to save the data in a JCR node in the step and retrieve it from the JCR node in a later step.

A MetaDataMap is the data structure which acts as a value map and allows users to set and get data among the steps.

Code Example
This use case is specific to the content pages. Here, we will select the user/group to review the pages based on the count of the children pages of the given payload. If the count is greater than zero then Administrators will approve the pages, otherwise the Content Authors.

To achieve this use case, we will first find the count of children pages of the given payload in a process step, then we will set the count in the MetaDataMap instance which will then be retrieved in the next dynamic participant step which will return the appropriate user to approve the page.

(Yeah, I know this use case is trivial but it is enough to show the concepts related to MetaDataMap).

Read Full Blog

Day 14 - AEM Workflows (Part III)

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager