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

Not able to delete filed in metadata schema (Cannot Delete Field! One or more field(s) are dependant on the field.)

Avatar

Level 4

Hello, There.

i was adding multiple field labels to AEM assets Metadata schema to test the field limit and now when i try to delete the field labels it's blocking with error "Cannot Delete Field! One or more field(s) are dependant on the field."

Has anyone experienced this error before and how to fix or find the dependent fields.

krishna_garikapati_1-1692878177550.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @krishna_garikapati,

This issue is related to cascading metadata feature:

Long story short, you can control visibility or other aspects of field in metadata schema base on value(s) of other field. This can be done using Rule editor.

In your particular example it looks that one or many fields in your schema has a Rule that rely on different field, and you are trying to remove the field that is dependency to others.

So you first have to delete this relationship, before you will be able to successfully remove filed that is used by other fields.

Information about dependency is stored under granite:data node located under main node that defines specific filed in you schema.

cascading-metadata.jpg

To identify this you can either verify all the fields in your schema, checking Rule section. Or you can run below query.

The query search for all the fields that has any dependency, you can modify query on your own changing condition related to cascadeVisibilityFrom property.

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/conf]) AND s.[sling:resourceType] = "dam/gui/components/admin/schemafield" AND s.[/granite:data/cascadeVisibilityFrom] <> ""

More specific query, that will look only for fields that depends on Language property (./jcr:content/metadata/dc:language)

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/conf]) AND s.[sling:resourceType] = "dam/gui/components/admin/schemafield" AND s.[/granite:data/cascadeVisibilityFrom] = "./jcr:content/metadata/dc:language"

View solution in original post

4 Replies

Avatar

Community Advisor

@krishna_garikapati interesting, never seen this kind of error, what kind of field is it? Is the field is used anywhere else? Are their any assets with metadata populated with this field?

Avatar

Correct answer by
Community Advisor

Hi @krishna_garikapati,

This issue is related to cascading metadata feature:

Long story short, you can control visibility or other aspects of field in metadata schema base on value(s) of other field. This can be done using Rule editor.

In your particular example it looks that one or many fields in your schema has a Rule that rely on different field, and you are trying to remove the field that is dependency to others.

So you first have to delete this relationship, before you will be able to successfully remove filed that is used by other fields.

Information about dependency is stored under granite:data node located under main node that defines specific filed in you schema.

cascading-metadata.jpg

To identify this you can either verify all the fields in your schema, checking Rule section. Or you can run below query.

The query search for all the fields that has any dependency, you can modify query on your own changing condition related to cascadeVisibilityFrom property.

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/conf]) AND s.[sling:resourceType] = "dam/gui/components/admin/schemafield" AND s.[/granite:data/cascadeVisibilityFrom] <> ""

More specific query, that will look only for fields that depends on Language property (./jcr:content/metadata/dc:language)

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/conf]) AND s.[sling:resourceType] = "dam/gui/components/admin/schemafield" AND s.[/granite:data/cascadeVisibilityFrom] = "./jcr:content/metadata/dc:language"

Avatar

Level 4

Hello, Lukasz.

Thanks, For the detailed explanation. However, i was deleted the other fields that are updated to map the property as it was test form and later able to delete the issue fields.

Avatar

Community Advisor

Hello @krishna_garikapati 

 

Since, you have added the fields just to check the threshold, may be just take the package of the Schema from a healthy instance and deploy here.

 

A replace mode in package should clean-up the redundant fields and you should have the expected metadata schema


Aanchal Sikka