AEM Metadata Schema Dynamic Dropdown

Avatar

Avatar
Validate 1
Level 3
DhirajAg
Level 3

Likes

12 likes

Total Posts

65 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile

Avatar
Validate 1
Level 3
DhirajAg
Level 3

Likes

12 likes

Total Posts

65 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile
DhirajAg
Level 3

16-04-2019

I have a dropdown field in the metadata schema editor and I want the options of this dropdown to be populated dynamically from a servlet response. I am following below guide to achieve it. There is a question around my requirement and from the author's answer it seems just pointing the JSON path to the servlet should help achieve it. Has anybody come across this before? Do you know if it works coz I have not been able to achieve it. If i point the JSON path to an nt:file it works.

Using a JSON file with the Dropdown widget on the Metadata Schema | Content Management

Options array from the servlet or in the JSON file

{

"options": [

{

"value": "en-gb",

"text": "English-United Kingdom"

},

{

"value": "en-us",

"text": "English-United States"

},

{

"value": "fr-ca",

"text": "French-Canada"

},

{

"value": "fr-fr",

"text": "French-France"

},

{

"value": "de-de",

"text": "German-Germany"

},

{

"value": "es-mx",

"text": "Spanish-Mexico"

},

{

"value": "es-es",

"text": "Spanish-Spain"

}

]

}

JSON path value - /etc/tags/custom/industries.options.json

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

16-04-2019

You can populate a GRANITE Select with a Sling Servlet. Is this dropdown a Granite Select field?

Avatar

Avatar
Validate 1
Level 3
DhirajAg
Level 3

Likes

12 likes

Total Posts

65 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile

Avatar
Validate 1
Level 3
DhirajAg
Level 3

Likes

12 likes

Total Posts

65 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile
DhirajAg
Level 3

16-04-2019

It's in the asset metadata schema not in a component.

Avatar

Avatar
Boost 1
Level 1
sarahm89689524
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
sarahm89689524
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
sarahm89689524
Level 1

26-06-2019

Not sure if this is what you're talking about but it could be in a Show/Hide that's in the standard library. Here's a video on this FWIW.

D

Avatar

Avatar
Validate 1
Level 2
ektaa69139387
Level 2

Likes

8 likes

Total Posts

13 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Give Back
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
ektaa69139387
Level 2

Likes

8 likes

Total Posts

13 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Give Back
Boost 5
Boost 3
Boost 1
View profile
ektaa69139387
Level 2

04-02-2021

Hi, I am replying on an old thread. But I had the similar problem and not found any solution so tried some custom approach and able to achieve this.

Solution:

1. overlay/customise default  metadataschema using metadataschema editor.(http://www.sgaemsolutions.com/2017/02/overrideoverlay-dam-asset-metadata-in.html )

2. Add custom dropdown field using datasource object to populate dropdown.

https://helpx.adobe.com/experience-manager/using/aem65_coral_resourcetypes.html#UseaDataSourceObject... 

 

For Example: I have added below dropdown in my metadataschema dialog xml to dynamically populate dropdown from my servlet

 <_x0031_612365521559
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="dam/gui/components/admin/schemafield"
                                        emptyText="Select Option"
                                        fieldLabel="Collections"
                                        name="./jcr:content/metadata/test"
                                        resourceType="granite/ui/components/coral/foundation/form/select">
                                    <granite:data
                                            jcr:primaryType="nt:unstructured"
                                            choicesCascading="default"
                                            cq-msm-lockable="./metadata/test"
                                            metaType="dropdown"
                                            requiredCascading="default"
                                            visibilityCascading="default"/>
                                    <datasource
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="<servlet resourceType>"
                                            addNone="{Boolean}true"/>
                                    <cascadeitems
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="dam/gui/coral/components/admin/schemaforms/formbuilder/cascadeitems"/>
                                </_x0031_612365521559>