calling AEM servlet from form | Community
Skip to main content
Level 2
Nov 8, 2022 9:09 PM UTC
Solved

calling AEM servlet from form

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Mayank_Gandhi
Mayank_GandhiAccepted solution
Employee
Nov 9, 2022 3:46 AM UTC

@formuser1 

1. Create a client libs folder 

 

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:

 

4 replies

Mayank_Gandhi
Mayank_GandhiAccepted solution
Employee
Nov 9, 2022 3:46 AM UTC

@formuser1 

1. Create a client libs folder 

 

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:

 

Translate
formuser1Author
Level 2
Nov 9, 2022 4:54 AM UTC

@mayank_gandhi this worked. thanks!

Translate
Employee
Nov 8, 2022 9:12 PM UTC

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 

Translate
formuser1Author
Level 2
Nov 9, 2022 4:54 AM UTC

thanks @workflowuser 

Translate