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.

  1. Right-click the locale folder at the following path and select Overlay Node:

    /libs/fd/cm/config/defaultApp/locale

  2. Ensure that the Overlay Node dialog has the following values:

    Path: /libs/fd/cm/config/defaultApp/locale

    Overlay Location: /apps/

    Match Node Types: Checked

  3. Click OK.

  4. Click Save All.

  5. Right-click the following file and select Copy:

    /libs/fd/cm/config/defaultApp/locale/ACMExtensionsMessages.properties

  6. 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.

  7. 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.

  8. 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.

NOTE
You may need to clear the browser cache.
  1. Go to https://[host]:'port'/system/console/bundles. If necessary, log in as Administrator.

  2. Locate the Adobe Asset Composer Building Block bundle. Restart the bundle: click Stop and then click Start.

    Adobe Asset Composer Building Block

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.
  1. Go to https://'[server]:[port]'/[ContextPath]/crx/de. If necessary, log in as Administrator.

  2. 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:

    1. Right-click the js folder at the following path and select Overlay Node:

      /libs/fd/cm/ccr/gui/components/admin/clientlibs/ccrui/js

    2. 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

    3. Click OK.

    4. Click Save All.

  3. In the js folder, create a file named ccrcustomization.js with the code for action handling of the button using the following steps:

    1. 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.

    2. Double-click the ccrcustomization.js file to open it in CRX.

    3. 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">&times;</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

NOTE
This step is required only if you are on an OSGI setup and LC integration is required for the type of customization you are implementing.

The LCA process runs on the LiveCycle server and requires the server address and the login credentials.

  1. Go to https://'[server]:[port]'/system/console/configMgr and login as Administrator.

  2. Locate Adobe LiveCycle Client SDK Configuration and click Edit (edit icon). The Configurations panel opens.

  3. 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

    Adobe LiveCycle Client SDK Configuration

Install LiveCycle Archive (LCA)

The required LiveCycle process that enables email service process.

NOTE
To view what this process does or to create a similar process of your own, you need Workbench.
  1. Log in as Administrator to LiveCycle® Server adminui at https:/[lc server]/:[lc port]/adminui.

  2. Navigate to Home > Services > Applications and Services > Application Management.

  3. If SendLetterForReview application is already present, skip the remaining steps in this procedure, otherwise continue to the next steps.

    SendLetterForReview application in the UI

  4. Click Import.

  5. Click Choose File and select SendLetterForReview.lca.

    Select SendLetterForReview.lca file

  6. Click Preview.

  7. Select Deploy assets to runtime when import is complete.

  8. 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.

  1. Log in as Administrator to https:/[host]:'port'/system/console/configMgr.

  2. Locate and click Adobe LiveCycle Client SDK Configuration. The Adobe LiveCycle Client SDK Configuration panel appears.

  3. In the Service Name list, click + icon and add a serviceName SendLetterForReview/SendLetterForReviewProcess.

  4. 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.

  1. Log in with Admin credentials to LiveCycle Server adminui at https:/[lc server]:[lc port]/adminui.

  2. Navigate to Home > Services > Applications and Services > Service Management.

  3. Locate and click EmailService.

  4. In SMTP Host, configure the email service.

  5. 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.

  1. 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

  2. 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.