Summary:

When you specify a list e.g. CaseList in  Administration -> Cases -> Lists so that is has Default Order By set to Yes and Allow Order By set to Yes for multiple fields then you will get an error when you select the Quick Look tab on a company record.

Actual result:

An error is displayed in the UI:

An unexpected event has occurred: SQL Code: 156
Exception: SQL Error

Expected result:

The Quick Look screen should be displayed.

More info:

Error in logs:

SQL Error : Incorrect syntax near the keyword 'DESC' (select * from vListCases WITH (NOLOCK) WHERE Case_PrimaryCompanyId=5 ORDER BY case_createddate desc DESC )

This in an issue in Sage CRM 7.1 SP2.

Resolution:

This issue cannot be reproduced in Sage CRM 7.2b.

Workaround:

Remove the "Default Order By" option from all but one field on CaseList.

Alternatively, the issue can be worked around using a custom ASP page.

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.

<!-- #include file="sagecrm.js" -->
<%
    var compId = CRM.GetContextInfo("Company","comp_companyid");

    CRM.GetTabs("Company");

    var mainContainer = CRM.GetBlock("Container")

    var commBlock = CRM.GetBlock("CommunicationList");
    commBlock.ArgObj = "CmLi_Comm_CompanyId = " + compId
        + " AND comm_type <> 'RecuMaster' AND (COALESCE(Comm_Private, N'') = N'' "
        + "OR (COALESCE(Comm_Private, N'') <> N'' AND (CmLi_Comm_UserId = "
        + CRM.GetContextInfo("user", "user_userid") + ")))";

    var oppoBlock = CRM.GetBlock("OpportunityList");
    oppoBlock.ArgObj = "oppo_primarycompanyid = " + compId;

    var caseBlock = CRM.GetBlock("CaseList");
    caseBlock.ArgObj = "Case_PrimaryCompanyId = " + compId;

    mainContainer.AddBlock(commBlock);
    mainContainer.AddBlock(oppoBlock);
    mainContainer.AddBlock(caseBlock);

    mainContainer.AddButton(CRM.Button(CRM.GetTrans("GenCaptions","New Task"), "newtask.png", CRM.Url(361)+"&PrevUrl="+CRM.Url("QuickLook.asp")));
    mainContainer.AddButton(CRM.Button(CRM.GetTrans("WebPicker","NewAppointment"), "newappointment.png", CRM.Url(362)+"&PrevUrl="+CRM.Url("QuickLook.asp")));
    mainContainer.AddButton(CRM.Button(CRM.GetTrans("TabNames","NewOpportunity"), "newopportunity.gif", CRM.Url(1190)));
    mainContainer.AddButton(CRM.Button(CRM.GetTrans("Button","NewCase"), "newcase.gif", CRM.Url(1192)));

    mainContainer.DisplayButton(Button_Default) = false;

    CRM.AddContent(mainContainer.Execute());
    Response.Write(CRM.GetPage())
%>

The ASP page should be saved to your CRM CustomPages directory as QuickLook.asp, and added it to your Company tab group as a replacement for the existing QuickLook tab. Additional SQL clauses for each grid can be added relatively easily.

If you wish, you should be able to use ListBlock.RowsPerScreen to limit the number of rows per list;  in the above, the lists will appear longer than in the default QuickLook.