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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
Thanks,
Siva
You can follow the below link.
Please do check this. If required any additional help let know
Thanks
Siva
The link you provided explain how to to create a clientlibs for custom component. It is not related to my use case
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.
Thanks,
Siva
@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