How To: Setup 'Your Order has Shipped' Invoice Emails
There are two steps to creating emails that are automatically created and sent as a result of orders moving from one stage in the Sales Invoice Manager, for example shipping, to another such as invoice:
- Setup the Message Template
- Setup the Trigger Rule
- Note: the Document Rules generate an email when a customer has the following set-up against them:
- When the customer's invoice contact has an e-mail address.
- When there is no email address for the invoice contact the invoice address' email address will be used.
Setup the Message Template
- Open an Email Manager screen .
- Click in the Message Templates radio button to display existing message templates.
- Press Ctrl+N or click .
- Add a template code in the Template Code.
- Add a template description in the Template Desc field.
- Select INVOICE from the Trigger Type drop-down.
- In the Options section tick as required:
- Enter the brand email address, if setup and using, in the Use Brand Email Address field.
- Tick the Show Pack Children checkbox if pack children should be displayed in the email body.
- 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 formatted using HTML.[1][2]
- If not using the default from address then insert a replacement email address in the From field.
- Add a Subject for the email, for example Your items have shipped.
Note: you can add tags into the Subject area by selecting them and using the upper button. - 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.
- Build the To Follow Item Template (if using) to show stock items that are being shipped separately by adding the relevant tags with the blue background to the To Follow 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 Example of a Shipped Email Message Template. [3]
- Add the yellow $ITEM_TEXT tag where you wish the list of items being shipped to be placed in the email body.
- Add the yellow $TO_FOLLOW_ITEM_TEXT tag (if using) where you wish the list of items on the sales order but not being shipped with this shipment.
- Press Ctrl+S or click to save the Message Template. For an example of the resulting template see shipped email example.
Notes
- ? For formatting the email body including adding images see How To: Insert an Image into an Email
- ? If using the $BOXES_CONSIGNMENT_REF tag which supersedes the $CONSIGNMENT_REF option then the HTML checkbox MUST be ticked so that the recipient receives an email with a clean and clear hyperlink to click through in order to track their parcel. This tag adds the Courier URL from
[ System Data | Couriers ]
and consignment reference in automated despatch emails to customers. Where an invoice has been packed into more than one box, this tag will display the individual consignment references generated (including URLs, if specified in[ System Data | Couriers ]
), with a line break between each one, see How To: Setup Email Consignment References for Boxes. - ? Linking to courier websites can be done by including the tracking reference $CONSIGNMENT_REF and the link to the courier website in the message body. For advanced functionality using conditional text see Adding Conditional Courier and Consignment Text below.
Adding Conditional Courier and Consignment Text
Using conditional text in Message Templates is an Advanced User feature. |
For more information see How To: Use DECODE in Email Manager.
Notes:
- Using IF statements and conditional text is possible but not user friendly. The statements are formatted using XML.
- "Equals" is the only supported operator at present.
- This functionality does not work when nested inside each another tag structure.
- If you need to do different actions for other couriers you will need to add a condition for each matching courier text.
- If you need help with other examples please email Support.
Example One - Match on One Property of the Courier
Example one uses the COURIER_TYPE which is the information defined in the Courier Name column in [ System Data | Sales Order Processing | Couriers ]
screen.
The following will check if the COURIER_TYPE matches against the text CityLink:
- If true it will add the fictitious URL for citylink tracking.
- If False it will add the text
- "leave this blank to ignore other couriers".
- If an error occurs then it will add the text:
- "leave this blank to ignore errors".
- "leave this blank to ignore errors".
<DECODE value1="$COURIER_TYPE" operator="equals" value2="CityLink" trueText="Look here to track your order: www.citylinkexample.com/track?=$CONSIGNMENT_REF" falseText="leave this blank to ignore other couriers" errorText="leave this blank to hide errors"></DECODE>
Note: if using the $BOXES_CONSIGNMENT_REF
tag then the second line above should be:
trueText="Look here to track your order: $BOXES_CONSIGNMENT_REF"
This will pull the appropriate Courier URL from [ System Data | Couriers ]
and add the consignment reference at the end for each box being shipped. To set this up see How To: Setup Email Consignment References for Boxes.
Example Two - Match on Two Properties of the Courier
Example two uses:
- The COURIER_CODE which is the information defined in the Code column in
[ System Data | Sales Order Processing | Couriers ]
screen and - the COURIER_TYPE which is the information defined in the Courier Name column in
[ System Data | Sales Order Processing | Couriers ]
screen.
The following will check if the COURIER_TYPE matches against the text CityLink and COURIER_CODE matches the Code held against the courier in [ System Data | Sales Order Processing | Couriers ]
:
- If true it will add the fictitious URL for citylink tracking.
- If False it will add the text
- "leave this blank to ignore other couriers".
- If an error occurs then it will add the text:
- "leave this blank to ignore errors".
- "leave this blank to ignore errors".
<DECODE value1="$COURIER_CODE" operator="equals" value2="CityLink" trueText="Look here to track your order: www.citylinkexample.com/track?=$CONSIGNMENT_REF" falseText="leave this blank to ignore other couriers" errorText="leave this blank to hide errors"></DECODE> <DECODE value1="$COURIER_TYPE" operator="equals" value2="CityLink" trueText="Look here to track your order: www.citylinkexample.com/track?=$CONSIGNMENT_REF" falseText="leave this blank to ignore other couriers" errorText="leave this blank to hide errors"></DECODE>
Note: if using the $BOXES_CONSIGNMENT_REF
tag then the second line above for both <DECODE> options should be:
trueText="Look here to track your order: $BOXES_CONSIGNMENT_REF"
This will pull the appropriate Courier URL from [ System Data | Couriers ]
and add the consignment reference at the end for each box being shipped. To set this up see How To: Setup Email Consignment References for Boxes.
Setup the Trigger Rule
Email Trigger Rules prompt the system into creating and in some instances automatically sending emails from Khaos Control.
- Open an Email Manager screen .
- Click in the Trigger Rules radio button to display existing trigger rules.
- Press Ctrl+N or click .
- 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 shipped 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 a shipped rule and they depend on your business processes and the order of stages in the Sales Invoice Manager.
- Method One - when an invoice goes from invoicing to a further stage then the email will be created:
- Double click on Old Invoice Status to add it to the Active Conditions grid.
- Focus in the Comparison column and press =.
- Focus in the lookup Value column then press Ctrl+F8 and select orders - invoicing stage.
- Double click on New Invoice Status to add it to the Active Conditions grid.
- Focus in the Comparison column and press >.
- Focus in the lookup Value column then press Ctrl+F8 and select orders - invoicing stage.
- Method Two - when an invoice goes from shipping into Issue the email will be created:
- Double click on Old Invoice Status to add it to the Active Conditions grid.
- Focus in the Comparison column and press =.
- Focus in the lookup Value column then press Ctrl+F8 and select orders - Shipping stage.
- Double click on New Invoice Status to add it to the Active Conditions grid.
- Focus in the Comparison column and press =.
- Focus in the lookup Value column then press Ctrl+F8 and select orders - Issue stage.
- Method One - when an invoice goes from invoicing to a further stage then the email will be created:
- Press Ctrl+S or click to save the Trigger Rule. For an example of a trigger rule see example of a Trigger Rule.