Expand my Community achievements bar.

How to build dependency between cq:tags in the metadata schema form?

Avatar

Level 2

I have the following requirement: Create asset metadata as a cq:tag and define dependency between two tags. Here are the details.

In the Metadata Schema Form Editor, I added a Standard tag from and defined the following configuration:

AravindAnand_0-1763972403091.png

 

In the Rules tab, when I select Visible, based on new rule, the only options that I get are the ones for which I have defined the values in the metadata schema form; there is no option to select a value of cq: tag.

AravindAnand_1-1763972403092.png

 

I can use the rules tab and define a dependency if I use a drop-down list with values defined in the Metadata schema form. However, I could not create a drop-down with cq:tags

Here is what I require –

  • Use tag defined in Tools > General > Tagging to display the value as dropdown in Metadata schema form
  • Use one tag (Content Type) value (Help Center) to define a dependency to another tag (Delivery Type)
  • When a user selects Help Center from the list of three tag values: Help Center, VCA, and AI for Content Type, the Delivery Type, which has tags values, PDF and Website must be displayed.
  • If VCA or AI is selected as Content Type tag value, then Delivery Type tag form should not be displayed.

Can you please help with pointer on how to achieve them?

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 5

Hi @AravindAnand ,

 

Please follow below steps,

 

Option 1: Dropdown with Hardcoded Values (Recommended - Easiest)

  • Replace tag fields with Dropdown components
  • Manually enter tag values (Help Center, VCA, AI)
  • Map to property: ./jcr:content/metadata/contentType
  • Use Rules tab normally - values will now appear
  • Limitation: Must maintain values in two places

Option 2: Custom JavaScript

  • Add clientlib to metadata editor
  • Listen for tag field changes
  • Show/hide dependent field with JavaScript
  • Requires: Frontend development skills

Option 3: Custom Component

  • Develop custom metadata field component
  • Fetches tags dynamically + supports Rules
  • Requires: Java/JavaScript development

Quick Implementation (Option 1):

  1. Add Dropdown field for Content Type
    • Options: Help Center, VCA, AI
    • Map to: ./jcr:content/metadata/contentType
  2. Add Dropdown field for Delivery Type
    • Options: PDF, Website
    • Map to: ./jcr:content/metadata/deliveryType
  3. In Rules tab:
    • Select "Visible" for Delivery Type field
    • Condition: Content Type = "Help Center"

Note: Out-of-box tag fields don't support Rules dependencies. You must use dropdown fields instead.

 

Thanks,

Vishal

Avatar

Level 2

Thanks @VishalKa5 for sharing your inputs. Option 1 that you have suggested for quick implementation works; currently, I have it setup like this. However, this creates a problem of maintenance, asset search, and translation. And that is why I want to move the metadata as cq:tags for each of ease of maintenance, asset search, and managing translations. 

 

Is there a way to pull cq:tags as dropdowns in the metadata schema form?

Avatar

Level 5

Hi @AravindAnand ,

 

You want tag-based dropdowns that work with Rules tab while maintaining:

  • Easy maintenance (single source in tagging)
  • Proper asset search functionality
  • Translation support

Why It Doesn't Work Out-of-Box:

  • Tag fields = dynamic component (Rules tab can't read values)
  • Dropdown fields = static values (Rules tab works, but duplicates tags)
  • These are fundamentally incompatible architectures

The Solution: Bridge the Gap

Build a custom dropdown component that combines both capabilities:

What it does:

  • Looks like a dropdown to the Rules engine (so dependencies work)
  • Fetches values dynamically from your tag namespace (no duplication)
  • Stores data as proper tag references (search and translation work)

How to build:

  1. Extend AEM's standard select component: granite/ui/components/coral/foundation/form/select
  2. Create a datasource servlet that reads from /content/cq:tags/[your-namespace]
  3. Configure component to:
    • Pull tag values at runtime
    • Display as dropdown options
    • Save as tag path in metadata
  4. Use this custom component in your Metadata Schema Form
  5. Rules tab now sees it as a regular dropdown with values

Invest in the custom component. One-time development effort solves all your requirements permanently.

Thanks,

Vishal