Introduction:

The KB article shows you how to put a sorting mechanism in any other way than the current way - by product ID - in a mail merge for a quote.

Instructions:

The basic overview of this is simply changing the SQL query for a view that is used for mail merges.

1. Go into Administration -> Customisation -> Quotes and click on the tab at the top for Views
2. Click on the view ‘vMailMergeChildrenQuotes’
3. Click on Change on the right hand side
4. Delete the script in ‘View Script’ and replace it with the following:

create view vtestcomp2 as select top(99.999) percent CASE WHEN NewProduct.prod_name IS NULL then quit_description else NewProduct.prod_name END AS
quit_ItemName, QuoteItems.*, NewProduct.* FROM QuoteItems Left Outer Join NewProduct
ON QuIt_ProductId = Prod_ProductId WHERE Quit_Deleted IS NULL
ORDER BY prod_productfamilyid

5. If the customer wants to sort it by product name or some other field in product, simply swap the last line “ORDER BY prod_productfamilyid” with “ORDER BY quit_ItemName” (or whatever column name you would like to use)
6. Click save
7. Go into Administration -> System -> Metadata and refresh the metadata.
8. Now try a mail merge on a sample quote.

You should now see the quote being sorted by the column of your choosing

Disclaimer:
WARNING: The techniques or examples contained in this email are for illustrative purposes only, and have not been tested in a production environment. The techniques or examples used are not necessarily supported features of SAGE CRM, and may not have been previously tested or implemented on a production environment. Before attempting to implement any of these techniques or examples on a production environment, they should be tested thoroughly, as use of these techniques may cause unexpected behaviour. SAGE can accept no responsibility for any issues arising from the use of these techniques. Please ensure that you back up your database and application fully before implementing any changes of this nature.