Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Populate Dropdown fields using datasource is not working on local AEM

Avatar

Level 4

Hi ,

We have a requirement to populate the dropdown values by reading the JSON value using datasource .So  I had uploaded JSON data and created a servlet to populate the values in dropdown .But it is not working on local AEM environment whereas it works on lower AEM instance .Please suggest whether this has any dependencies .

 

Thanks in Advance!

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hey @Keerthi97 
I have faced a similar issue in my project.
The root cause for me was that I have used a reserved keyword of AEM for node names such as "config" for data sources. Renaming the node name had solve the issue for me.

Only admin is supposed to access config, hence, It is working with admin credentials but not using author.

Regards,

Arpit Varshney

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hey @Keerthi97 
I have faced a similar issue in my project.
The root cause for me was that I have used a reserved keyword of AEM for node names such as "config" for data sources. Renaming the node name had solve the issue for me.

Only admin is supposed to access config, hence, It is working with admin credentials but not using author.

Regards,

Arpit Varshney

Avatar

Community Advisor

Hi @Keerthi97 ,

In the DataSorce Servlet, com.adobe.cq.commerce.common.ValueMapDecorator is replaced with org.apache.sling.api.wrappers.ValueMapDecorator. This could be the cause of the import. Please check and update.

GitHub Reference - https://github.com/adobe/asset-share-commons/pull/377  

If it is still not working, please give more details on the code and node xml.

Hope this will help !

Regards

Shiv Prakash

Avatar

Community Advisor

Hi,

Can you check this https://aemlab.blogspot.com/2019/07/aem-touch-ui-dropdown-from-json.html 

 

Are you using any service usr for reading json?



Arun Patidar

Avatar

Community Advisor

@Keerthi97 you can check for the below things:

1. If on your local AEM instance, the servlet is getting resolved or not. If it is not getting resolved, you might need to check and update the "org.apache.sling.servlets.resolver.SlingServletResolver" configuration if you are having anything other than the list mentioned in the property "Execution Paths".

2. Is there any system resource resolver being used.

Map<String, Object> param = new HashMap<String, Object>(); param.put(ResourceResolverFactory.SUBSERVICE, "writeService");

ResourceResolver resolver = null;

try { resolver = resolverFactory.getServiceResourceResolver(param) } catch (Execption e){}

And then create the configuration as shown below:

shaileshbassi_0-1656323538406.png

And the provided the respective read permission to read the json

Reference: https://one-inside.com/aem6-resourceresolver-access-in-services/

 

Thanks