top of page
  • Writer's pictureHeena

One way to Create A Conditional Loop In AEM WorkFlow

Updated: May 2


1. Create a workflow variable - Example: loopcount

The value of the workflow variable is maintained throughout the workflow instance


2. Increment the variable using Set Variable Step - Example: loopcount=loopcount+1

Changes to variable values affect only the instance of the process in which the change occurs. For example, when a workflow is initiated and variable data changes, the changes affect only that instance of the workflow. The changes do not affect other instances of the workflow that were initiated previously or are initiated subsequently.


3. Add rule a definition in Goto Step to define the exit criteria - Example: loopcount<10

The Goto Step allows you to specify the next step in the workflow model to execute, dependent on the result of a routing expression.

You can use variables to define the routing expression using the expression editor. In this example, the Goto step specifies the Tester Process Step(i.e. Step before Or Split) as the next step if the value for the loocount variable is less than 10 thus creating a loop. If the loopcount increases to 11 the workflow will exit the loop and go to normal flow.



That's all for today! If you've found this blog post informative or helpful, I’d greatly appreciate it if you could give it a like. It keeps me motivated 💛


Enjoying my ad-free blog? Support by buying me a coffee! I've kept this space ad-free, sponsoring it myself to maintain its purity. Your contribution would help keep the site afloat and ensure quality content. Thanks for being part of this ad-free community.

241 views

Related Posts

See All

Comentarios


bottom of page