Set default action based on file extension at the time of document drop

By | January 30, 2012

In Sage CRM, we have the document drop functionality. We can drag the document on document drop icon and it will open the communication task screen with the attached document. Now suppose we want to set the default action value of communication based on the document extension. For example if the document is word then the action will be “Letter In”.  Below is the simple client side script that you can add on the custom content box of the communication screen to achieve the same.
< snippet >
var sDocumentName=””;
var  FileExt=””;
sDocumentName= new String(GetKeyValue(“SaveDocName”));
if(sDocumentName==”” || sDocumentName==”null” || sDocumentName==”undefined”)sDocumentName=””;
            if(sDocumentName!=””)
            {
                        FileExt = new String(sDocumentName.substr(sDocumentName.lastIndexOf(‘.’) + 1));
                        if(FileExt==”” || FileExt==”null” || FileExt==”undefined”)FileExt=””;
                        if(FileExt==’pdf’)
                        {
                                    document.EntryForm.comm_action.value=’Ref’;
                        }
}
< /snippet >