Occasionally you may customer requirement to store relatively large numbers of documents associated with a company, person or opportunity record outside the main librabry mechanism. As an example of this requirement imagine an organisation that sells design services to real estate developers. Such a company may find that their sales person is regularly given dozens of files that include brochures, plans and photos that all form part of the information need for the customer to recieve a properly constructed proposal.
The document upload into Sage CRM allows the easy upload of files on an Ad Hoc basis but it can be time consuming when there are a large number of files that need importing.
I have previously touched on the batch import of documents in to the library in the article "Moving files into the Library using the serverside COM API".
Another approach that can be taken is to allow the files to be copied directly by the system administrator to a folder on the network.
The snag is going to be that any files should not be accessible except via a URL. If the folder containing the files was a virtual directory then the files could be easily accessed via the browser. But placing a folder directly 'on the web' is potentially a security issue. For example Sage CRM's own library structure hides the documents and they can only be accessed via a URl that 'passes through' Sage CRM.
The way that the path to a file is build has has been discussed in the article "The display of a photo or image in the person screen".
Of course you could upload the document to an external Document Manager System but then you would have the challenge of building the integration.
In this example I have just created a folder called DemoFiles underneath the existing Library structure.
This folder contains a set of files.
You can see from this screen below I have been able to link to those documents which can then be downloaded.
The additional folder name has been stored in the company record in a field called comp_customfolder.
The code below is an ASP customization but the equivalent could also be carried out in the .NET API. I have used the Scripting.FileSystemObject.
Note: The variable sInstallName is created in the include file (sagecrmnolang.js/accpaccrmnolang.js/eware.js).
<!-- #include file ="sagecrm.js"-->
var contentBlock = CRM.GetBlock("content");
var myBlockContainer = CRM.GetBlock("Container");
DisplayButton(Button_Default) = false;
//example using objects
var mySystemObject = Server.CreateObject('Scripting.FileSystemObject');
var mySource = CRM.GetContextInfo("Company","comp_customfolder");
var myPath = "C:\\Program Files\\Sage\\CRM\\"+sInstallName+"\\Library\\" +mySource;
var myFolder = mySystemObject.GetFolder(myPath);
var myFiles = new Enumerator(myFolder.Files);
var myCount = 0;
myFile = myFiles.item();
contentBlock.contents+='</ul><br>There are '+myCount+ ' files<br>';