Automating metadata schema assignment for dynamic folders in AEM Assets

In Adobe Experience Manager Assets, organizations often manage large or dynamic folder structures, such as /content/dam/brands/<brand_name>/components and /content/dam/brands/<brand_name>/materials, with new brand folders created regularly. The requirement is to automatically assign the appropriate metadata schema to specific subfolders, such as components or materials, without manual intervention. This article explains how to automate metadata schema assignment for these folders in Adobe Experience Manager Assets.

Description description

Environment

Adobe Experience Manager Assets (all versions)

Symptoms

  • Manual assignment of metadata schemas to each new folder is required in the AEM UI.
  • There is no out-of-the-box feature to assign schemas based on folder name patterns or paths.
  • This process is inefficient for organizations with dynamic or large-scale folder structures.

Cause

AEM Assets requires explicit schema assignment to folders. The assigned schema is stored as a property on the folder node, and there is no native support for wildcard or pattern-based schema mapping.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Review current product capabilities: AEM Assets does not support native wildcard or pattern-based metadata schema assignment. Schema assignment must be performed explicitly for each folder.

  2. To automate schema assignment for dynamic folder structures, implement a custom solution such as a workflow, event handler, or script that triggers when new folders are created.

  3. Example approach (event handler):

    1. Develop a custom event handler that listens for the creation of new folders under a specified path, such as /content/dam/brands/.
    2. When a new brand folder is detected, the handler checks for subfolders named components or materials.
    3. The handler programmatically sets the appropriate metadata schema property (folderMetadataSchema) on these subfolders.
    4. This process ensures that all assets and subfolders beneath them inherit the correct schema.
  4. Validate the automation in a non-production environment to confirm correct schema assignment and inheritance.

  5. Monitor and maintain: Update the automation logic as needed if folder structures or naming conventions change.

  6. After deploying the automation, create a new brand folder and confirm that the correct metadata schema is automatically assigned to the relevant subfolders.

recommendation-more-help
experience-cloud-kcs-help-kbarticles