Populate Dropdown fields using datasource is not working on local AEM | Community
Skip to main content
June 27, 2022
Solved

Populate Dropdown fields using datasource is not working on local AEM

  • June 27, 2022
  • 4 replies
  • 1476 views

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!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ArpitVarshney

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

4 replies

ArpitVarshney
Community Advisor
ArpitVarshneyCommunity AdvisorAccepted solution
Community Advisor
June 27, 2022

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

Shiv_Prakash_Patel
Community Advisor
Community Advisor
June 27, 2022

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
arunpatidar
Community Advisor
Community Advisor
June 27, 2022

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
ShaileshBassi
Community Advisor
Community Advisor
June 27, 2022

@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:

And the provided the respective read permission to read the json

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

 

Thanks