• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

Mailbox event, execute before message is saved

Some tooltip text!
• 3 minutes to read
 • 3 minutes to read

This is a CRMScript you can add under the menu System design in the screen System Script.

Here you can add CRMScript code that will be run for all mailboxes before the mail is taken by any mail filter, and also before it is saved.

There are several variables available in this context.

  • To get a variable: getVariable("xxx")
  • To set a variable: setVariable("xxx", <value>), where <value> is a valid value for the field you are trying to set.

Here follows a list of all available variables that are possible to modify.

Variable Description
subject Subject of the mail
author Author of the mail
ticketExists 1 if this is a mail on an existing request, else 0
sendAutoReply 1 if there will be sent an auto-reply, else 0
whyNoAutoReply Description on why there will not be sent any auto-reply
toTrashcan 1 if this mail will be sent to the trashcan, else 0
toBeDeleted 1 if this mail will be deleted, else 0

Read-only variables

Variable Description
body The plain text part of the mail
bodyHtml The HTML part of the mail
ticketId The ticket ID, -1 if this is a new ticket
fromEjournal 1 if the mail is from another AIM Server, else 0
isBounce 1 if this is a bounce, else 0
mailboxId The id of the mailbox that the mail came in to
Note

If you load a ticket object with the given ticket ID, it is not recommended to change the values of this ticket. Later the ticket will be saved, and the values you have saved on the ticket might be overwritten. Thereby you should only modify the variables listed above.

Example

This script will generate a new request if the incoming email is originally supposed to be connected to an existing request. The script will tell the email engine to generate a new request only if the original request is closed.

Ticket ticket;
ticket.load(getVariable("ticketId").toInteger());

if (ticket.getValue("status") == "2")
  setVariable("ticketExists", "0");  // Generate new request
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top