This is part 11 of multistep tutorial for creating your first interactive communications document for the print channel. In this part, we will launch the agent ui interface for creating ad-hoc correspondence on form submission.

This article will walk you through the steps involved in opening agent ui interface on submitting a form. Typical use case is for customer service agent to fill in a form with some input parameters and on form submission agent ui is opened with data prepopulated from form data model prefill service.The input parameters to the form data model prefill service are extracted from the form submission.

String accountNumber = request.getParameter("accountnumber"))
ParameterMap parameterMap = new ParameterMap();
RequestParameter icLetterId[] = new RequestParameter[1];
icLetterId[0] = new FormFieldRequestParameter("/content/dam/formsanddocuments/retirementstatementprint");
parameterMap.put("documentId", icLetterId);
RequestParameter Random[] = new RequestParameter[1];
Random[0] = new FormFieldRequestParameter("209457");
parameterMap.put("Random", Random);
Map map = new HashMap();
CustomParameterRequest wrapperRequest = new CustomParameterRequest(slingRequest,parameterMap,"GET");
wrapperRequest.getRequestDispatcher("/aem/forms/createcorrespondence.html").include(wrapperRequest, response);

Line 1 : Get the accountnumber from the requestparameter

Line 2- 8: Create parameter map and set appropriate keys and values to reflect the documentId,Random.

Line 9 - 10: Create another Map object to hold the input parameter defined in the Form Data Model.

Line 11: Set the slingRequest attribute "paramMap"

Line 12-13: Forward the request to the servlet


To test this capability on your server

  • Import and install the assets related to this article using package manager.
  • open the /apps/AEMForms/openprintchannel/POST.jsp uisng crxde. Make sure the string passed to FormFieldRequestParameter is valid documentId.(Line 19).
  • Open the webpage and enter accountnumber and submit the form.
  • Agent UI interface should open with the data pre-populated specific to the accountnumber entered in the form.


Make sure your Form Data Model's Get operation's input parameter is bound to Request Attribute called "accountnumber" for this to work. If you change the name of the bindingvalue to any other name, make sure the change is reflected on line 25 of the POST.jsp mentioned in second bullet point above.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy