How to dynamically populate AEM page property dialog ? | Community
Skip to main content
Mario248
Level 7
July 23, 2023
Solved

How to dynamically populate AEM page property dialog ?

  • July 23, 2023
  • 2 replies
  • 1850 views

  I would like to create a new custom tab in the AEM page properties. The process of creating a page property is straightforward, but inside the custom tab, I want to make a call to an external system and get a json response, so that I can build a dialog (with text fields and path fields). To get the json response, I created a servlet, but I want to call this servlet each time a property dialog appears and populate its fields. Would it be possible to do that? Should I update dialog.xml for this or can I manage it directly at the page level (/content)?  

 

Please share me some best practices on this use cases.

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 SivakumarKanoori

@mario248 :

 

You want to make a servlet call when you opened a component dialog right . So that you can write a JS as below inside you can make ajax call to your servlet.

 

(function ($, $document) {
"use strict";
$document.on("dialog-ready", function() {
alert('Its coming here on dialog open');
});
})($, $(document));

 

But the above code will get invoked for every component.

 

As explained in the below link, you can use extraclientlibs, which will invoke the targeted client library that is configured.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/hi-all-i-was-trying-to-call-js-on-dialog-ready-with-document-on/m-p/400767

 

Thanks,

Siva

 

 

 

 

2 replies

SivakumarKanoori
Community Advisor
Community Advisor
July 24, 2023

@mario248 :

 

You can follow the below link.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/hi-all-i-was-trying-to-call-js-on-dialog-ready-with-document-on/m-p/400767

 

Please do check this. If required any additional help let know

 

Thanks 

Siva

Thanks,Siva
Mario248
Mario248Author
Level 7
July 24, 2023

The link you provided explain how to to create a clientlibs for custom component. It is not related to my use case

SivakumarKanoori
Community Advisor
SivakumarKanooriCommunity AdvisorAccepted solution
Community Advisor
July 24, 2023

@mario248 :

 

You want to make a servlet call when you opened a component dialog right . So that you can write a JS as below inside you can make ajax call to your servlet.

 

(function ($, $document) {
"use strict";
$document.on("dialog-ready", function() {
alert('Its coming here on dialog open');
});
})($, $(document));

 

But the above code will get invoked for every component.

 

As explained in the below link, you can use extraclientlibs, which will invoke the targeted client library that is configured.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/hi-all-i-was-trying-to-call-js-on-dialog-ready-with-document-on/m-p/400767

 

Thanks,

Siva

 

 

 

 

Thanks,Siva
Saravanan_Dharmaraj
Community Advisor
Community Advisor
July 24, 2023

@mario248 You can write data source servlets as given in the example link below and make use of it in the dialog to populate the values dynamically. In the servlet you need to make the call to external system and return the values to dialog.

http://www.sgaemsolutions.com/2019/01/dynamically-populate-drop-down-values.html