Customization for exporting Notes

By | December 23, 2019

Hello everyone! In my previous blog I have explained how we can export notes for leads using sage CRM’s standard report functionality. We can do the same with the help of coding as well.

New Stuff: Client Side Script to Concatenate Address

Recently, one of our client asked us to add a button on notes list which will export all notes data in excel format for that particular lead. To do so you can follow below steps.

Add button to Notes tab naming “Export to Excel”.

  1. Log on to sage CRM.
  2. Navigate through below path:
    Administration |Advanced Customization | Button Groups
  3. Click on New, give name as Notes and select action as “notelist” and click on Save.
    Button Group
    Button Group
  4. Now add button to newly created button group naming Export to excel Action as customfile and in custom file field fill up your file name.
  5. Click on Add and then click on Save. A button will get added on notes tab of Lead as shown below:
    Export to Excel
    Export to Excel

Create ASP file using below code for exporting content to excel.

var  strLeadID=Request.QueryString(“Key44”);
var exportingContent = “<table border=1 style=’border-collapse:collapse’>”;
exportingContent += “<tr>”;
exportingContent += “<td><B>”+eWare.GetTrans(“colNames”,”Lead_CompanyName”)+”</B></td>”;
exportingContent += “<td><B>”+eWare.GetTrans(“colNames”,”Lead_PersonFirstName”)+”</B></td>”;
exportingContent += “<td><B>”+eWare.GetTrans(“colNames”,”Lead_PersonLastName”)+”</B></td>”;
exportingContent += “<td
exportingContent += “<td><B>”+eWare.GetTrans(“colNames”,”Note_Note”)+”</B></td>”;
exportingContent += “<td><B>”+eWare.GetTrans(“colNames”,”Lead_Description”)+”</B></td>”;
var NotesRecSQL=””;
NotesRecSQL = “SELECT * FROM Notes “;
NotesRecSQL += ” JOIN Lead ON note_foreignid = Lead_LeadID AND note_foreigntableid = 59″
NotesRecSQL += ” WHERE Lead_deleted IS NULL AND Note_Deleted IS NULL and lead_leadid = “+strLeadID;
NotesRecords = eWare.CreateQueryObj(NotesRecSQL);
                                        exportingContent += “<tr>”;
                                       var companyName = CheckNull(new
                                        var PersFirstName = CheckNull(new String(NotesRecords(“Lead_PersonFirstName”)));
                                        var PersLastName = CheckNull(new String(NotesRecords(“Lead_PersonLastName”)));
                                        var PhoneNumber = CheckNull(new String(NotesRecords(“Lead_PersonPhoneNumber”)));
                                        var Note = CheckNull(new String(NotesRecords(“Note_Note”)));
                                        var PersDescription = CheckNull(new String(NotesRecords(“Lead_Description”)));
                                        exportingContent += “<td>”+companyName+”</td>”;
                                        exportingContent += “<td>”+PersFirstName+”</td>”;
                                        exportingContent += “<td>”+PersLastName+”</td>”;
                                        exportingContent += “<td>”+PhoneNumber+”</td>”;
                                        exportingContent += “<td>”+Note+”</td>”;
                                        exportingContent += “<td>”+PersDescription+”</td>”;
                                        exportingContent += “</tr>”;
exportingContent += “</table>”;
Response.ContentType = “application/”;
Response.Buffer = true;
function CheckNull(pmField)
        if(pmField== “” || pmField == “NULL” || pmField== “undefined”)pmField = “”;
                       return pmField; }

Now on click of “Export to Excel” button an excel file will get generated as follows:


You can use this code for any data all you need to provide is proper column names and data value. Hope this will help.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business ManagerSage CRM Project ManagerSage CRM Resource PlannerSage CRM Contract ManagerSage CRM Event ManagerSage CRM Budget PlannerGmail IntegrationSage CRM Mobile Service SignatureSage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at We will be glad to assist you.