Uploading the Support Document

Open the Create Correspondence user interface (not in preview mode) and click button Send For Review.

View full size graphic
Send For Review

The FileReference class opens a dialog box for the user to select a file to upload. This sample only supports attaching PDF files. The onLoad converts the data to a ByteArray which can then be encoded to Base64 format. The Base64 string is incorporated in the custom param in the XML. The following example shows the use of FileReference class to achieve the same results by clicking the Browse button.
....................... 
private var f:FileFilter = new FileFilter("PDF","*.pdf"); 
private var fileReference:FileReference = new FileReference(); 
 
public var ccrCustomObject:CCRCustomActionHandler; 
....................... 
private function onBrowseClick(event:MouseEvent):void 
{ 
    var f:FileFilter = new FileFilter("PDF","*.pdf"); 
    if(fileReference) 
    { 
    fileReference.browse([f]); 
        fileReference.addEventListener(Event.SELECT,function(event:Event){fileReference.load();}); 
    fileReference.addEventListener(Event.COMPLETE,onFileComplete); 
    } 
} 
....................... 
private function onFileComplete(event:Event):void 
{ 
    if(fileReference.data) 
    { 
        var b64:Base64Encoder = new Base64Encoder(); 
        b64.encodeBytes(fileReference.data); 
      ccrCustomObject.encodedString = b64.toString(); 
              } 
    ccrCustomObject.mailTo = mailTo.text; 
    dispatchEvent(new Event('onClose')); 
 } 
.......................

When removing the pop-up, the control returns to the CustomActionHandler -> sendforreview(event) method. After calling the default Letter process, the post process that was specified in the <serviceName> tag of acmExtensionsConfig.xml gets called. Create a custom Skin class 'SendForReviewPopUpSkin' over a custom Host component ' SendForReviewPopUp ' which is called on clicking the Send For Review button, and takes the input for email address (text input) and attachment (file reference). Create the custom CSS file to include the custom styles:

/* CSS file */ 
@namespace s "library://ns.adobe.com/flex/spark"; 
@namespace mx "library://ns.adobe.com/flex/mx"; 
@namespace custom "com.adobe.solutions.cmg.ccr.custom.*"; 
 
custom|SendForReviewPopUp 
{ 
     
    skinClass : ClassReference("com.adobe.solutions.cmg.ccr.custom.SendForReviewPopUpSkin"); 
}
And include this custom CSS file in main.mxml file as:
<fx:Style source="/css/custom_ccr_styles.css"/>

Rebuild and redeploy the Solution template to view the changes. For information on rebuilding and redeploying, see Building and deploying the Solution Template�.

// Ethnio survey code removed