Working with script templates

Script templates specify how emails are handled. You can associate a template with specific mailboxes and you can use Email Objects to customize the script templates. For example, to change the way in which email attachments are saved.

For more information about working with Email Objects, see Email Management and objects and Customizing script templates using objects.

Two script templates are provided with Email Management:

  • Communications.js (Communications template) is deployed by default when you set up Email Management. For information about email handling when you are using the Communications template, see Working with the Communications template.
  • Support.js (Support template) is for use in a customer support environment. For information about email handling when you are using the Support template, see Working with the Support template.

There are three core functions are at the base of both Communications.js and Support.js that run in the following order: BeforeMainAction, MainAction, AfterMainAction.

BeforeMainAction and AfterMainAction are declared in the script file. MainAction is not declared. The MainAction function is generated from the rules defined on the Rules input form in Sage CRM. The function should never be declared in any JavaScript file used with Email Management. If you require any complex functionality, it can be coded into the BeforeMainAction or AfterMainAction functions.

We recommend that you use one of these scripts. However, if neither are suitable, you can write a new script. Please contact your Certified Sage CRM Consultant before writing new scripts. You must implement new scripts in a test environment before installing them on a live system.