How To: Setup Emails Triggered on Sales Order Type
Emails can be triggered if they are of a certain sales order type, for example; sales order, proforma, quotation, return credit and return exchange.
There are two steps to creating emails that are automatically created and sent for specific types of sales orders:
- Setup the Message Template
- Setup the Trigger Rule
Notes:
- The Document Rules generate an email when a customer has the following setup against them:
- When the customer's invoice contact has an e-mail address.
- If there is no email address for the invoice contact the invoice address' email address will be used.
- For an example of the finished screens see Email Sales Order Type Example.
The example below is for a new quotation, the email will be sent when the quotation is saved.
Setup the Message Template
- Open an Email Manager screen .
- Click in the Message Templates radio button.
- Press Ctrl+N or click .
- In the Setup area:
- Add a template code in the 'Template Code'.
- Add a template description in the 'Template Desc' field.
- Select the 'INVOICE' from the Trigger Type drop-down.
- Add email addresses in the 'CC List' and/or 'BCC List' fields if required.
- In the Options area:
- Tick the 'Use Brand Email Address' checkbox if associating the brand with the quotation.
Note: the brand email address is setup against the brand in[ System Data | Sales Order Processing | Branding ]
. - Tick the 'Show Pack Children' checkbox if pack children should be displayed in the email body if you are including the stock items on the quote in the body of the email.
- If you want to add an entry into the contact's Comm Log when the email has been sent then tick the 'Add to Comm Log when sent' checkbox.
- Tick the HTML Format checkbox if the email is to be formatted using HTML.
Note: for formatting the email body including adding images, for example the brand logo, see How To: Insert an Image into an Email.
- Tick the 'Use Brand Email Address' checkbox if associating the brand with the quotation.
- In the Template area:
- If not using the brand email address or wishing to override the default email address enter the email address in the 'From' field.
- Add a 'Subject' for the email, for example Thank you for your quotation.
Note: you can add tags into the Subject area by selecting them and using the upper button, for example adding the sales order code. - If you wish to include the stock items on the quotation in the body of the email enter build the Item Template to show stock items being shipped by adding the relevant tags with the blue background to the Item Template field using the adjacent button.
- Add the body of the email into the Message Template. The available tags to the right can be added into the body of the message are details that can be taken from the invoice, for example, tag $COMPANY_NAME will print out the name of the company that the invoice is for when the email is generated. They are added by double clicking the tag which is introduced into the message text at the cursor position, for an example see the example of a message template for a new quotation.
- Add the yellow $ITEM_TEXT tag where you wish the list of items being shipped to be placed in the email body.
- Press Ctrl+S or click to save the Message Template. For an example of the resulting template see sales order type message template example.
Setup the Trigger Rule
Email Trigger Rules prompt the system into creating and in some instances automatically sending emails from Khaos Control.
Note: each condition MUST be true at the same time in order for the rule to work.
- Open an Email Manager screen .
- Click in the Trigger Rules radio button to display existing trigger rules.
- Press Ctrl+N or click .
- In the Setup area:
- Add the trigger rule code in the Rule Code field.
- Add a trigger rule description in the Rule Description field.
- Select INVOICE from the Trigger Type drop down.
- Select the message template that was created above from the Message Template drop-down.
- Tick the Send Email Immediately checkbox if the email is to be automatically sent and not held in the Pending emails section.
- Tick the Active checkbox when you wish the Trigger Rule to be enabled.
- There are many different ways to setup the triggers, below is an example of setting up a trigger so that when a sales order is of type 'Quotation' and it is first saved, then send an email:
- Focus on SOrder Type and click on the button to add it to the Active Conditions grid.
- Focus in the Comparison column and enter =.
- Focus in the lookup Value column then press Ctrl+F8 and select Quotation stage.
- Press Ctrl+S or click to save the Trigger Rule. For an example of a trigger rule see quotation rule example with one condition.