Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Custom Workflow Best Practice

Avatar

Level 2

Hey, guys. I'm in the process of creating a custom workflow process / step that will list all assets within a folder and subfolders. I initially used the Query Builder API, but I don't know if this is the best way to go about it. How would you approach something like this? Are there alternatives?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@mrvnaz if the target scope is folders and subfolders, always best practice is to go with iterative/traversal pattern than query pattern.. 

 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/query-an...

 

 

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

@mrvnaz if the target scope is folders and subfolders, always best practice is to go with iterative/traversal pattern than query pattern.. 

 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/query-an...

 

 

Avatar

Community Advisor

@mrvnaz : Before suggesting alternatives, it would be important to know

  • How is your content structured.
  • Are you in process of defining the structure or it is already created and you have to implement a solution to access it now. If already created, you can judge if can be iterated based on paths or would require a query based approach to retrieve them better.
  • Every workflow trigger would give the same response OR are there any input parameters on workflow.

Based on the answers of these, we can decide what may be an ideal approach to this. As a general rule, it is not advisable to do lot of queries in AEM as it will overburden your instance etc.
thanks.

Avatar

Community Advisor

Querying is most expexisve feature wothin AEM. In place of that you can overlay workflow process step dialog and add a path browser in place of writing lot of custom baked code. You can read it's metadata at the time of execution.

 

We can suggest more optimized soluion if you can elaborate your use case.

Avatar

Level 5

I am curious to know what the exact use case is, in workflow do you intend to show the items some where?  Or do you want to find child items or filter child items of the payload based on some criteria, etc Based on the usecase, it makes sense to decide if u want to use a query or not like the experts suggested before me. Perhaps details of the exact usecase can help u get more directons.

Thanks !

Avatar

Community Advisor

@mrvnaz  I am thinking it's just you need the list of assets inside a folder for a reporting purpose. Go through below article which gives you an OOTB feature to list down the assets as json structure. https://experienceleague.adobe.com/docs/experience-manager-64/assets/extending/mac-api-assets.html?l...