Opening Agent UI On POST Submission

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.

The following video shows use case

Transcript
{Instructor} Hi, in this video, we will take a look at the use case of a user agent opening up partially completed interactive communication template, and further customizing the template before it is sent to the customer. So, what you see on the screen is a simple web form which lists the interactive communication templates. The agent selects the appropriate template and enters an account number and clicks on the Submit button. So, what you see on the screen is now the interactive communication template that is populated with information specific to this particular account number. Depending on the configuration of your communication template, the agent is allowed to enter the relationship manager name and the toll free number. So, for example the agent can enter the relationship manager’s name here, and can also enter a toll free number and those values get inserted into the appropriate location in the paragraph on the right hand side. The agent has also some liberty or some permissions to add or remove this particular image fragment here. And the agent can also edit the content of your document fragment by adding some text here and then clicking on Save so that text appears on the right hand side. Once the agent is satisfied with the customization of the template, he can click on the Submit button and that will trigger the appropriate workflow that is configured with this particular interactive communications template. -
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();
map.put("accountnumber",accountNumber);
slingRequest.setAttribute("paramMap",map);
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

NOTE
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
recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e