Hi @sai_navatej,
For dynamic dropdown, you need to use datasource and then point to a Servlet
Refer - https://experienceleague.adobe.com/en/docs/experience-manager-65/content/forms/customize-aem-forms/d... .
This can list all the Content fragment.
<fragmentPath1
granite:class="cfFragment1"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
emptyText="Select"
emptyOption="{Boolean}true"
fieldLabel="Random Name"
name="./fragmentPath1">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="abc/components/randomComponent"
componentPath="${requestPathInfo.suffix}"/>
Next you can use ContentFragment API and get the contentfragments
ContentFragment contentFragment = fragmentResource.adaptTo(ContentFragment.class);
Once User selects a CF from the dropdown, you should have a custom JS at component dialog level which is triggered on change
$(document).off("change", ".cfFragment1, function(event) {
var fragmentPath1 = $(".cfFragment1").val();
$.ajax({
url: "/servletPath",
data: {
fragmentPath1: fragmentPath1
}
}).done(function (result) {
if (result != null && result != undefined && result != "") {
if (result.headline) {
$(".someClass").val(result.yourObj.value);
$(".someClass").val(result.yourObj.module);
}
}
});
});
which can call another Servlet and it can return a Json response created from getter/setter.
Fetch all the relevant details/fields and set them.