Objective:To uncompress the server's .SAF file and store the same in the local machine in local\SiebelRoot\Client\TEMP folder
Example:In Contact-->Attachment applet one custom button is placed with Method = "EventMethodDownloadfile".Clicking on that button for a particular Contact Attachment record, .SAF file stored in the server will get uncompressed and downloaded in the local \SiebelRoot\Client\TEMP folder.
The sample code would be written in the Contact Attachment applet, as follows:
if(MethodName == "EventMethodDownloadFile"){
try
{
var sFileReturn = "";
var sFileName = "";
var sStatus = "";with(this.BusComp())
{
//The variable sFileReturn returns the uncompressed downloaded local file path and the String "Success" if the file download is successful
sFileReturn = InvokeMethod("GetFile", "ContactFileName");
sStatus = sFileReturn.substring(0, sFileReturn.indexOf(","));if (sStatus == "Success")
{
sFileName = sFileReturn.substring(sFileReturn.indexOf(",") + 1);
}
throw(sFileName);//To test the local downloaded uncompressed file's location
}
}
catch(e)
{
throw(e);
}
finally
{
sStatus = null;
sFileName = null;
sFileReturn = null;
}
return (CancelOperation);
}
return (ContinueOperation);
}