Expand my Community achievements bar.

SOLVED

How to add other than metadata properties in Conditions field in AEM Workflow launcher

Avatar

Level 4

Hi, 

We currently have a workflow launcher (L1) which triggers WF-A when there are any changes under /content/dam(/.*/)dogs
Now we have to trigger another workflow - WF-B when there are any changes under this - /content/dam(/.*/)dogs/m2. So we have another launcher for this as well (L2)

To avoid WF-1 getting triggered when there are changes under /content/dam(/.*/)dogs/m2 we have to add a Condition.
How to add path as an condition to exclude (/content/dam(/.*/)dogs/m2) in L1 ? I have known about adding only the properties in the condition list of a WF launcher.
Anyone aware of any implicit object name we can give in the condition field ?
something like this ?
path!= /content/dam(/.*/)dogs/m2
OR Any different idea is appreciated.

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@mrudul  - 

 

Also, have you tried editing the condition and selcting the condition as the path? And then enter a RegeX that matches paths that do not start with "/content/dam(/.*/)dogs/m2".

 

For example, you can use the following regular expression: ^(?!\/content\/dam\/.*\/dogs\/m2).*$.

View solution in original post

5 Replies

Avatar

Community Advisor

@mrudul Cant you add a property for level as "level1"  or "level2" and trigger the WF based on that property ? you can add that property by metadata profile. Just an idea.

https://experienceleague.adobe.com/docs/experience-manager-65/assets/administer/metadata-config.html...

 

 

Avatar

Community Advisor

Hello @mrudul

 

  • You can achieve the desired outcome by using a custom workflow process step that evaluates the path and decides whether to proceed with the workflow or not.

 

Here's how you can approach this:

  1. Create a custom workflow process step that will be responsible for evaluating the path condition. This custom step will be invoked in WF-A. In the custom process step, you can use the ResourceResolver to access the current path of the resource being processed. Then, you can compare it with the exclusion path (/content/dam(/.*/)dogs/m2). If the path matches the exclusion criteria, you can choose to exit the workflow without proceeding further.

By implementing this approach, you can effectively exclude the /content/dam(/.*/)dogs/m2 path from being processed by WF-A while still maintaining a workflow launcher for changes under /content/dam(/.*/)dogs. Note that this requires custom development in AEM using Java to create the custom workflow process step.

 

Regards,

Tanika 

Avatar

Level 4

Thanks for this @Tanika02 . Yes, using a custom step is always an option. I was trying to understand implicit objects if there are available readily to directly use. 
I believe we can also use a simple ecma script to get the payload path and switch accordingly. Ntl, thanks for elaborating. 

Avatar

Correct answer by
Community Advisor

@mrudul  - 

 

Also, have you tried editing the condition and selcting the condition as the path? And then enter a RegeX that matches paths that do not start with "/content/dam(/.*/)dogs/m2".

 

For example, you can use the following regular expression: ^(?!\/content\/dam\/.*\/dogs\/m2).*$.