Expand my Community achievements bar.

SOLVED

calling AEM servlet from form

Avatar

Level 2

I have a rest endpoint that I want to invoke. I dont want to use fdm, how to invoke AEM servlet from form? can we set checkbox dynamically with servlet response?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@formuser1 

1. Create a client libs folder 

Mayank_Gandhi_0-1667963595869.png

 

2. In the JS file create a function

 

function getPdf() {
var settings = {
"async": true,
"url": "URL will go here",
"method": "POST",
data: {
'data': result.data
}
}
$.ajax(settings).done(function(response) {
guideBridge.resolveNode("pdf").value = response;
})

}



 

3. Go to form, map your client libs.

4. Go to rule editor/code editor and map the function which is making ajax call as shown below:

Mayank_Gandhi_1-1667965481610.png

 

View solution in original post

4 Replies

Avatar

Employee Advisor

you can use javascript to make the call. Create a client library and in that client library have your javascript make the call to the servlet. You can capture the response and display the value in the form using the guide bridge 

Avatar

Correct answer by
Employee Advisor

@formuser1 

1. Create a client libs folder 

Mayank_Gandhi_0-1667963595869.png

 

2. In the JS file create a function

 

function getPdf() {
var settings = {
"async": true,
"url": "URL will go here",
"method": "POST",
data: {
'data': result.data
}
}
$.ajax(settings).done(function(response) {
guideBridge.resolveNode("pdf").value = response;
})

}



 

3. Go to form, map your client libs.

4. Go to rule editor/code editor and map the function which is making ajax call as shown below:

Mayank_Gandhi_1-1667965481610.png