IMailMessageAutoAction
By implementing the IMailMessageAutoAction interface in the application script you can define custom actions when loading a message from the service mailbox before saving the message to the log of an existing ticket or before creating a new ticket. In the newly created script, set the value of the Name property (the name of the automatic action) in the action class constructor.
To store properties and action settings, we recommend defining the Settings class in a separate script that you create from the Class Library template.
Interface methods
Method | Description |
---|---|
OnMessageReceived | Read a new message from the service mailbox. |
OnMessageReceived
The actual action can be performed when loading a message from the service mailbox before saving the message to the log of an existing ticket or before creating a new ticket. In the implemented method, define both the conditions for executing the operations and the operations themselves.
If the message is not further processed after automatic actions, a warning is written to the event log.
If more than one of these automatic actions is implemented, they are called
sequentially until one of them returns false
,
and the order in which they are called is not guaranteed.
- Syntax: bool OnMessageReceived(SqlConnection con, SqlTransaction trans, MailMessage message, int sectionId, int ticketId, int fromPersonId)
- Parameters:
- con - SqlConnection to the database.
- trans - SqlTransaction of the ongoing database transaction.
- message - message object.
- sectionId - the service ID (tHdSection.iSectionId) which the message was loaded to.
- ticketId - ID of the ticket (tHdTicket.iHdTicketId) to which the message belongs according to the subject, or zero if it is a new ticket creation.
- fromPersonId - message sender ID (tPerson.iPersonId), or Host account, if the message sender is not found among the users.
- Return value:
-
bool - return the return value
true
-
or
false
indicating whether or not the message should continue to be processed by default.
For an example use case, see the AssignToSolverByEmail application template.