Implementation overview

Extend the Action Handler:
  1. In Flash Builder, open the CreateCorrespondence project in the Package Explorer view.

  2. Navigate to CreateCorrespondence > src > Correspondence > presentation

  3. Create ActionScript class, such as SaveAsDraftActionHandler, which extends the class. To support the newly added action, two things are required:

    1. The logic for enabling/disabling newly added action, by overriding the function actionEnabled(extraParams:Object=null):Boolean.

    2. The handling of action when user clicks the button when overriding the implementation for function handleAction(extraParams:Object=null):void

      The following example is a sample Implementation of that extends CCRDefaultActionHandler. :
          import com.adobe.icc.external.dc.ExternalApi; 
          import com.adobe.icc.external.dc.InvokeParams; 
          import com.adobe.icc.util.Debug; 
          import com.adobe.icc.util.UrlHelper; 
              import mx.controls.Alert; 
          import mx.utils.ObjectUtil; 
          public class SaveAsDraftActionHandler extends CCRDefaultActionHandler 
              public static const SAVE_AS_DRAFT_ACTION:String = "SaveAsDraft"; 
              public function SaveAsDraftActionHandler() 
                  var htmlUrl:String = ExternalApi.getInstance().htmlGetUrl(); 
        "invoke url: " + htmlUrl); 
                  invokeParams = new InvokeParams(htmlUrl); 
               * Called when the user clicks an action 
               * @param extraParams additional arguments that may be passed to handler (For future use) 
              override public function handleAction(extraParams:Object=null):void 
                  if(action && == SAVE_AS_DRAFT_ACTION) 
                      //Additional logic to show popup to ask file save name goes here. 
                      var saveName:String =; 
               * Should the action be enabled in toolbar 
               * @param extraParams 
               * @return flag indicating whether the action should be enabled 
              override public function actionEnabled(extraParams:Object=null):Boolean 
                  //Always enable the Action. 
                  return true; 
              private function submitLetter(saveName: String):void 
                  var service:ISubmitService = ServiceProvider.getSubmitService(); 
                  var params:Object = new Object(); 
                      params = ObjectUtil.copy(action.actionConfig); 
                  params["cm_actionName"] =; 
                  //Add additional custom params here which is available under <icc:meta> tag. 
                  params["cm_saveName"] = saveName; 
                  var reload:Boolean = false; 
                  if(!(invokeParams.letterId) && !(invokeParams.letterName)) 
                      //If Letter is loaded without letterName or letterId then it must be reload 
                      reload = true; 
                  //Invoke the default letter post process 
                  service.submitLetterWithParams(letterVO, letterData, 
                      false, invokeParams.useLatest, reload, null, params).addHandlers 
                          // result handler 
                              var response:Object = event.result as Object; 
                              //Redirect to success page if mentioned 
                              if (response.redirect) 
                                  // redirect via new window or else the user is prompted to close the DC window before proceeding 
                                  if (UrlHelper.isValid(response.redirect)) 
                                      navigateToURL((new URLRequest(response.redirect)), "_blank"); 
                                      Debug.error("server returned invalid redirect URL: " + response.redirect); 
                                            "Save Successful"); 
                          // fault handler 
                              Debug.error("failed to submit " + letterVO + ":\n\t", event); 
                                            "Save Failed"); 
  4. Declare a private variable of type SaveAsDraftActionHandler in the file CreateCorrespondence > src > Correspondence > presentation > This variable is to ensure that the new class gets compiled in FlashBuilder.

    private var saveActionHandler:SaveAsDraftActionHandler;
  5. Modifying the acmExtensionsConfig.xml to add the custom action button. The modelExtension tag in the CorrespondenceManagementSolutionTemplate\package-resources\etc\aep\config\assetcomposer\apps\cm\acmExtensions\acmExtensionsConfig.xmlcan have a set of customAction child tags associated with it. Each customAction element represents an Action that would show up in the Create Correspondence user interface toolbar depending upon the permissions associated with it. Each can have attributes to allow configuration for that action. The attributes are listed below:




    The alphanumeric name for the action that must start with a character. Name is required param and must be unique within the modelExtensions tag.


    The label to display on the action button. This property can be localized.


    The tool tip for the action. This property can be localized.


    The name of the custom style that is applied to the action button that is packaged as part of Solution Template application.


    The corresponding action is shown only if user has the permission specified by permissionName.


    Fully qualified name of the ActionHandler class which is called when user clicks the action. This class must implement IActionHandler interface. The class must have a no-argument constructor.

  6. Add the Special Additional Configuration Parameters in Extensions Config:
    • serviceName: If a customAction contains a child tag with name serviceName. On click of that action a process is called with the name represented by serviceName tag. This process has same signature that of Letter PostProcess.

    • Parameters containing cm_ prefix in tag name: If a customAction contains child tags starting with name cm_, then in post process these parameters are available in the input xml under <icc:meta> tag with cm_ prefix removed.

    • actionName: Whenever a post process is called as a result of action click, the submitted xml contains a special tag with name <actionName> under <icc:meta> tag containing the name of the action taken by user.

  7. In this example to add the SaveAsDraft button, modify the CorrespondenceManagementSolutionTemplate\package-resources\etc\aep\config\assetcomposer\apps\cm\acmExtensions\acmExtensionsConfig.xml and add customAction element corresponding to SaveAsDraft. The name of the called ADEP process can be mentioned in the <servicename> tag. For example, in this case clicking the SaveAsDraft button calls the ADEP process with the name SaveLetterDraft/SaveLetterDraftProcess. The path where the correspondence is saved can be mentioned in the <cm_path> tag. The following code snippet is an example of the new action element:
    <?xml version="1.0" encoding="utf-8"?> 
            <modelExtension type="LetterInstance"> 
                <customAction name="Submit" label="loc.letterInstance.submit.label" tooltip="loc.letterInstance.submit.tooltip" styleName="submitButton" permissionName="CM Letter Template Submit"/> 
                <customAction name="Close" label="loc.letterInstance.close.label" tooltip="loc.letterInstance.close.tooltip" styleName="closeButton"/> 
                <customAction name="SaveAsDraft" label="SaveAsDraft" tooltip="SaveAsDraft"  styleName="closeButton" actionHandler=""> 
  8. Rebuild and redeploy the Solution template to view the changes. For information on rebuilding and redeploying, see Building and deploying the Solution Template

The bottom toolbar in the Create Correspondence user interface now includes a new SaveAsDraft button. Clicking this button saves the correspondence in XML format. The name of the saved file is the letter name with the xml extension. You can enhance it to show a pop-up to capture the save filename by adding the functionality in handleAction function in the

To reload the saved correspondence type the following URL to the published instance in the browser: http://<hostname>:<port>/content/cm/createcorrespondence.html?cmDataUrl=file:///<filepath>/ClaimSubrogation.xml&cmUseLatest=1.

The SaveAsDraft is only applicable on published instances.

Note: The sample assumes that ADEP and Experience Services are running on the same server. The correspondence saved by the ADEP post process on the file system on the server is accessible in the reload URL.