Some thoughts about the Library

3 minute read time.
I hope that the material that I put here is of use and is relevant to developers and partners implementing CRM. I can't claim all the articles published here under my name as 'all my own work'. I am a magpie of code snippets and will quite happily steal the bright ideas of cleverer colleagues and post them here if I think it will answer a question.

One question that I have recently been asked is about the storing of attachments associated with inbound emails. Specifically where are the actual attachment files stored?

I think this question is concerned with incoming emails being handled by the Mail Manager. This is a subject that although it is covered on I believe the Level 2 syllabus and certainly it is within the Development Partner cycle of classes I have so far resisted publishing anything here.

One of the Mail Manager specific objects is the Mail Object itself. This object has properties one of which represents as a attachments the files that may have been sent with the mail object. The Attachment list object has the property LibraryPath which is documented in the developers guide. The LibraryPath property represents the path to the CRM library.

Thinking about this got me considering what we have already discussed on the blog.

To sum up...

Sage CRM offers users the ability to store files (.doc, xls, pdf etc) associated with the different entities represented within the system and these files can be added to the library either via direct upload or via mail merge in the case of Word Documents.

The library files are accessed via the interface from the Document tab which exists within the various entity summary screens. Each file stored in the folders on the server has a corresponding header record a Library table in the database. The library table record describes the files name and provides the interface that allows the file to be found and retrieved in the Sage CRM system. In the case of files such as Word Documents the properties of the libr_status can be used to control whether the file can be just downloaded for viewing or for editing.

The default location for the uploaded library files is on the web server

C:\Program Files\Sage\CRM\[installname]\Library

The location settings for the library is controlled in the screen.

Administration -> E-mail and Documents -> Documents & Reports Configuration

If it is necessary the library can be moved to a separate server. The path details for the library are held in the custom_sysparams table.

The company record in CRM has a field that decides where under the library the documents associated with that company will be stored.

The path is automatically decided as the company record is inserted and it is inherited by each person associated with that company. CRM uses initial folders for company & person documents.

If you run this SQL statement on a system that has Demo data installed:


select comp_name, comp_librarydir from company



Result will look like this, note the initial folders:



3G Homes 3\3G Homes(43)
A Midland & Sons A\A Midland Sons(44)
A Post A\A Post(45)
A &W Services A\A W Services
A.B.B. (Hellas) Systems Ltd A\A B B (Hellas) Systems Ltd(46)
A.I.G. Office (UK) Ltd A\A I G Office (UK) Ltd(47)
A.T.M. Intercapital A\A T M Intercapital(48)
Aaxxell Interavtive A\Aaxxell Interavtive(49)
AB McAlpine A\AB McAlpine(50)
ABB Nicholas A\ABB Nicholas(51)
Abercrombie Trading A\Abercrombie Trading(52)
Abstracts Management A\Abstracts Management(53)



Once files have been added to the library then we will need to access them again. The whole idea is that the files can be referenced again and again. The control of access to the files although can be a contentious issue, and you may actually need to add rules in to decide which team members or selected individuals can access the files.