The component manager allows us to deliver not only Meta Data changes to a system but to also drop in and manage files like new logos, icons, and ASP files.
This article will cover the methods
Syntax: CopyAspTo(SourceFileName As String, TargetFileName As String) Examples
- CopyAspTo('\\project.gif', '\\img\\icons\\project.gif');
The Source file is assumed to be in the CustomPages folder underneath the components folder within the INF folder. The file can then be copied to any location under the wwwroot folder of the install. See the diagram below.
If you are not used to working with strings in JScript then it may seem strange that the path is written like:
The double backslash \\ is an example of an Escape character. Escape characters are special characters that allow you to include in strings some characters you cannot type directly. Each of these characters begins with a backslash. The backslash is an escape character you use to inform the JScript interpreter that the next character is special.
Other examples of Escape characters are
\' Single quotation mark
\" Double quotation mark CreateNewDir();
When we move the files we can also create a new folder as our target. This uses the CreateNewDir() method.
Syntax: CreateNewDir(DirName As String) Example
CreateNewDir(GetDLLDir() + '\\CustomPages\\project');
This would create a folder called project underneath the CustomPages folder. The method GetDLLDir() returns the directory path containing the DLL e.g. c:\program files\sage\crm\crm\wwwroot.
There is a second method called GetInstallDir() that returns the directory path containing the root of the installation e.g. C:\Program Files\Sage\CRM\CRM
We can put all this together in this example:
var DLLDir = GetDLLDir();\\Get WWWRoot location for output location
var CustomPagesDir = DLLDir + '\\CustomPages\\';
var ImagesDir = DLLDir + '\\Img\\';
\\ append img folder to wwwroot location for IMG OUTPUT Directory
CopyAspTo('Company\\PersonPhoneRedirect.asp', CustomPagesDir +'Company\\PersonPhoneRedirect.asp');
There are more techniques that we can use with the Component Manager.
- QueryResults to File()
These are documented within the Developer guide and there are examples of usage in the Advanced Customization Wizard.
I have to thank one of my colleagues in Australia who provided the core of this article at the suggestion of a North American colleague.