Create a locale folder with properties file in the /apps branch
The ACMExtensionsMessages.properties file includes labels and tooltip messages of various fields in Create Correspondence user interface. For the customized actions/buttons to work, make a copy of this file in the /apps branch.
-
Right-click the locale folder at the following path and select Overlay Node:
/libs/fd/cm/config/defaultApp/locale
-
Ensure that the Overlay Node dialog has the following values:
Path: /libs/fd/cm/config/defaultApp/locale
Overlay Location: /apps/
Match Node Types: Checked
-
Click OK.
-
Click Save All.
-
Right-click the following file and select Copy:
/libs/fd/cm/config/defaultApp/locale/ACMExtensionsMessages.properties
-
Right-click the locale folder at the following path and select Paste:
/apps/fd/cm/config/defaultApp/locale/
ACMExtensionsMessages.properties file is copied in the locale folder.
-
To localize the labels of the newly added custom action/button, create the ACMExtensionsMessages.properties file for the relevant locale in
/apps/fd/cm/config/defaultApp/locale/
.For example, for localizing the custom action/button created in this article, create a file named ACMExtensionsMessages_fr.properties with the following entry:
loc.letterInstance.letterreview.label=Revue De Lettre
Similarly, you can add more properties, such as for tooltip and style, in this file.
-
Click Save All.
Restart the Adobe Asset Composer Building Block bundle
After making every server-side change, restart the Adobe Asset Composer Building Block bundle. In this scenario, the acmExtensionsConfig.xml and ACMExtensionsMessages.properties files on the server-side are edited, and hence the Adobe Asset Composer Building Block bundle requires a restart.
-
Go to
https://[host]:'port'/system/console/bundles
. If necessary, log in as Administrator. -
Locate the Adobe Asset Composer Building Block bundle. Restart the bundle: click Stop and then click Start.
After restarting the Adobe Asset Composer Building Block bundle, the custom button appears in the Create Correspondence User Interface. You can open a letter in the Create Correspondence User Interface to preview the custom button.
Add action handling to the button
The Create Correspondence user interface by default has implementation of ActionHandler in the cm.domain.js file at the following location:
/libs/fd/cm/ccr/gui/components/admin/clientlibs/ccr/js/cm.domain.js
For custom action handling, create an overlay of the cm.domain.js file in the /apps branch of CRX.
Handling the action/button on clicking action/button includes logic for:
- Making the newly added action as visibe/invisible: done by overriding the actionVisible() function.
- Enabling/disabling newly added action: done by overriding the actionEnabled() function.
- Actual handling of action when user clicks the button: done by overriding the implementation of the handleAction() function.
-
Go to
https://'[server]:[port]'/[ContextPath]/crx/de
. If necessary, log in as Administrator. -
In the apps folder, create a folder named
js
in the /apps branch of CRX with structure similar to the following folder:/libs/fd/cm/ccr/gui/components/admin/clientlibs/ccrui/js
Use the following steps to create the folder:
-
Right-click the js folder at the following path and select Overlay Node:
/libs/fd/cm/ccr/gui/components/admin/clientlibs/ccrui/js
-
Ensure that the Overlay Node dialog has the following values:
Path: /libs/fd/cm/ccr/gui/components/admin/clientlibs/ccrui/js
Overlay Location: /apps/
Match Node Types: Checked
-
Click OK.
-
Click Save All.
-
-
In the js folder, create a file named ccrcustomization.js with the code for action handling of the button using the following steps:
-
Right-click the js folder at the following path and select Create > Create File:
/apps/fd/cm/ccr/gui/components/admin/clientlibs/ccrui/js
Name the file as ccrcustomization.js.
-
Double-click the ccrcustomization.js file to open it in CRX.
-
In the file, paste the following code and click Save All:
/* for adding and handling custom actions in Extensible Toolbar. * One instance of handler will be created for each action. * CM.domain.CCRCustomActionHandler is actionHandler class. */ var CCRCustomActionHandler; CCRCustomActionHandler = CM.domain.CCRCustomActionHandler = new Class({ className: 'CCRCustomActionHandler', extend: CCRDefaultActionHandler, construct : function(action,model){ } }); /** * Called when user user click an action * @param extraParams additional arguments that may be passed to handler (For future use) */ CCRCustomActionHandler.prototype.handleAction = function(extraParams){ if (this.action.name == CCRCustomActionHandler.SEND_FOR_REVIEW) { var sendForReview = function(){ var serviceName = this.action.actionConfig["serviceName"]; var inputParams = {}; inputParams["dataXML"] = this.model.iccData.data; inputParams["letterId"] = this.letterVO.id; inputParams["letterName"] = this.letterVO.name; inputParams["mailId"] = $('#email').val(); /*function to invoke the LivecyleService */ ServiceDelegate.callJSONService(this,"lc.icc.renderlib.serviceInvoker.json","invokeProcess",[serviceName,inputParams],this.onProcessInvokeComplete,this.onProcessInvokeFail); $('#ccraction').modal("hide"); } if($('#ccraction').length == 0){ /*For first click adding popup & setting letterName.*/ $("body").append(popUp); $("input[id*='letterName']").val(this.letterVO.name); $(document).on('click',"#submitLetter",$.proxy( sendForReview, this )); } $('#ccraction').modal("show"); } }; /** * Should the action be enabled in toolbar * @param extraParams additional arguements that may be passed to handler (For future use) * @return flag indicating whether the action should be enabled */ CCRCustomActionHandler.prototype.actionEnabled = function(extraParams){ /*can be customized as per user requirement*/ return true; }; /** * Should the action be visible in toolbar * @param extraParams additional arguments that may be passed to handler (For future use) * @return flag indicating whether the action should be enabled */ CCRCustomActionHandler.prototype.actionVisible = function(extraParams){ /*Check can be enabled for Non-Preview Mode.*/ return true; }; /*SuccessHandler*/ CCRCustomActionHandler.prototype.onProcessInvokeComplete = function(response) { ErrorHandler.showSuccess("Letter Sent for Review"); }; /*FaultHandler*/ CCRCustomActionHandler.prototype.onProcessInvokeFail = function(event) { ErrorHandler.showError(event.message); }; CCRCustomActionHandler.SEND_FOR_REVIEW = "Letter Review"; /*For PopUp*/ var popUp = '<div class="modal fade" id="ccraction" tabindex="-1" role="dialog" aria-hidden="true">'+ '<div class="modal-dialog modal-sm">'+ '<div class="modal-content">' + '<div class="modal-header">'+ '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</code></button>'+ '<h4 class="modal-title"> Send Review </h4>'+ '</div>'+ '<div class="modal-body">'+ '<form>'+ '<div class="form-group">'+ '<label class="control-label">Email Id</label>'+ '<input type="text" class="form-control" id="email">'+ '</div>'+ '<div class="form-group">'+ '<label class="control-label">Letter Name</label>'+ '<input id="letterName" type="text" class="form-control" readonly>'+ '</div>'+ '<div class="form-group">'+ '<input id="letterData" type="text" class="form-control hide" readonly>'+ '</div>'+ '</form>'+ '</div>'+ '<div class="modal-footer">'+ '<button type="button" class="btn btn-default" data-dismiss="modal"> Cancel </button>'+ '<button type="button" class="btn btn-primary" id="submitLetter"> Submit </button>'+ '</div>'+ '</div>'+ '</div>'+ '</div>';
-
Add the LiveCycle process to enable action handling
In this scenario, enable the following components, which are a part of the attached components.zip file:
- DSC component jar (DSCSample.jar)
- Send letter for review process LCA (SendLetterForReview.lca)
Download and unzip the components.zip file to get DSCSample.jar and SendLetterForReview.lca files. Use these files as specified in the following procedures.
Get File
Configure the LiveCycle Server to run the LCA process
The LCA process runs on the LiveCycle server and requires the server address and the login credentials.
-
Go to
https://'[server]:[port]'/system/console/configMgr
and login as Administrator. -
Locate Adobe LiveCycle Client SDK Configuration and click Edit (edit icon). The Configurations panel opens.
-
Enter the following details and click Save:
- Server Url: URL of the LC server whose Send For Review service the action handler code uses.
- Username: Admin user name of the LC server
- Password: Password of the Admin user name
Install LiveCycle Archive (LCA)
The required LiveCycle process that enables email service process.
-
Log in as Administrator to LiveCycle® Server adminui at
https:/[lc server]/:[lc port]/adminui
. -
Navigate to Home > Services > Applications and Services > Application Management.
-
If SendLetterForReview application is already present, skip the remaining steps in this procedure, otherwise continue to the next steps.
-
Click Import.
-
Click Choose File and select SendLetterForReview.lca.
-
Click Preview.
-
Select Deploy assets to runtime when import is complete.
-
Click Import.
Adding ServiceName to the Allowlist Service list
Mention in the Experience Manager server the LiveCycle services you want to access the Experience Manager server.
-
Log in as Administrator to
https:/[host]:'port'/system/console/configMgr
. -
Locate and click Adobe LiveCycle Client SDK Configuration. The Adobe LiveCycle Client SDK Configuration panel appears.
-
In the Service Name list, click + icon and add a serviceName SendLetterForReview/SendLetterForReviewProcess.
-
Click Save.
Configure the email service
In this scenario, for Correspondence Management to be able to send an email, configure the email service in the LiveCycle server.
-
Log in with Admin credentials to LiveCycle Server adminui at
https:/[lc server]:[lc port]/adminui
. -
Navigate to Home > Services > Applications and Services > Service Management.
-
Locate and click EmailService.
-
In SMTP Host, configure the email service.
-
Click Save.
Configure the DSC service
To use the Correspondence Management API, download the DSCSample.jar (attached in this document as part of components.zip) and upload it to the LiveCycle server. After the DSCSample.jar file is uploaded to the LiveCycle server, the Experience Manager server uses the DSCSample.jar file to access the renderLetter API.
For more information, see Connecting AEM Forms with Adobe LiveCycle.
-
Update the Experience Manager server URL in cmsa.properties in DSCSample.jar, which is at the following location:
DSCSample.jar\com\adobe\livecycle\cmsa.properties
-
Provide the following parameters in configuration file:
- crx.serverUrl=https:/host:port/[context path]/[AEM URL]
- crx.username= Experience Manager user name
- crx.password= Experience Manager password
- crx.appRoot=/content/apps/cm
NOTE
Every time you make any changes at the server side, restart the LiveCycle Server.The DSCSample.jar file uses the renderLetter API. For more Information about the renderLetter API, see Interface LetterRenderService.