Integrating Create Correspondence UI with your custom portal integrating-create-correspondence-ui-with-your-custom-portal

CAUTION
AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

Overview overview

This article details how you can integrate the Create Correspondence Solution with your environment.

URL-based invocation url-based-invocation

One way to call the Create Correspondence application from a custom portal is to prepare the URL with the following request parameters:

  • the identifier for the letter template (using the cmLetterId parameter), or the name of the Letter template (using the cmLetterName parameter)

  • the URL to the XML data fetched from the desired data source (using the cmDataUrl parameter).

For example, the custom portal would prepare the URL as
https://[server]:[port]/[contextPath]/aem/forms/createcorrespondence.html?random=[timestamp]&cmLetterId=[letter identifier]&cmDataUrl=[data URL], which could be the href from a link on the portal.
If the portal has the Letter template name at hand, then the URL could be
https://[server]:[port]/content/cm/createcorrespondence.html?cmLetterName=[letter name]&cmDataUrl=[data URL].

NOTE
Calling in such a way is not secure since the necessary parameters are passed along as a GET request, by exposing the same (clearly visible) in the URL.
NOTE
Before calling the Create Correspondence application, save and upload the data to call the Create Correspondence UI at the given dataURL. This could either be done from the custom portal itself or through another back end process.

Inline data-based invocation inline-data-based-invocation

Another (and a more secure) way to call the Create Correspondence application could be to simply hit the URL at https://[server]:[port]/[contextPath]/aem/forms/createcorrespondence.html, while sending the parameters and data to call the Create Correspondence application as a POST request (hiding them from the end user). This also means that you can now pass along the XML data for the Create Correspondence application inline (as part of the same request, using the cmData parameter), which was not possible/ideal in the previous approach.

Parameters for specifying letter parameters-for-specifying-letter

Name
Type
Description
cmLetterInstanceId
String
The identifier for the letter instance.
cmLetterName
String

The identifier for the letter template.

If multiple CM letters exist with same name on a server, using the cmLetterName parameter in URL throws an error "Multiple letters exist with name." In such a case, use cmLetterId parameter in the URL instead of cmLetterName.

cmLetterId
String
The name of the Letter template.

The order of parameters in the table specifies the preference of parameters used for loading the letter.

Parameters for specifying the XML data source parameters-for-specifying-the-xml-data-source

Name
Type
Description
cmDataUrl
URL
XML data from a source file using basic protocols such as cq, ftp, http, or file.
cmLetterInstanceId
String
Using xml data available in Letter Instance.
cmUseTestData
Boolean
To reuse the test data attached in data dictionary.

The order of parameters in the table specifies the preference of parameters used for loading the XML data.

Other Parameters other-parameters

Name
Type
Description
cmPreview
Boolean
True to open the letter in preview mode
Random
Timestamp
To resolve the browser caching issues.

If you using http or cq protocol for cmDataURL, URL of http/cq should be accessible anonymously.

recommendation-more-help
a6ebf046-2b8b-4543-bd46-42a0d77792da