Search code examples
aem

Populate AEM forms dropdown field using data from a JSON file


I have a JSON file - options.json which looks like this -

{
"option1" : "abc",
"option2" : "xyz"
}

I have saved this file in AEM's DAM.

I want AEM form's dropdown list to be populated using the values from this file. How do I achieve this?

Please note - entering path of this file in the Items Load Path field doesnt work.


Solution

  • Based on the information you provided I assume that you want to do this in the Adobe product called AEM Forms.

    Solution outline:

    1. Create a REST service (could be a simple Servlet) that exposes the contents of the file as Json.
    2. Create a new AEM Forms DataSource and configure your REST service.
    3. Create a Form Data Model.
    4. Configure Form Data Model to use DataSource.
    5. Use Form Data Model in your Form component.

    You can find the documentation for this here:

    1. https://helpx.adobe.com/experience-manager/kt/forms/using/creating-datasource-feature-video-use.html
    2. https://helpx.adobe.com/experience-manager/6-3/forms/using/data-integration.html

    Google will give you more links and examples.