Step 4: Create an ASP page to display the Invoices list
To display the Invoice list for the current company, you need to create a custom ASP page.
- Create a new ASP page and save it as Invoices.asp.
- In the main block of the ASP page, include statements to perform the following tasks:
- Retrieve the current company ID and store it in a variable:
ThisCompany = CRM.GetContextInfo("Company","Comp_CompanyId"); - Create a block for the Invoice list and store it in a variable. You must reference the list created in Step 3: Create a List object for Invoices.
Invoices = CRM.GetBlock("Invoice_List"); - Display the list on the screen by executing the List block. Make sure you include a statement to show records for this company only :
CRM.AddContent(Invoices.Execute("Customerid="+ThisCompany));
Response.Write(CRM.GetPage());
The Invoices.asp file is displayed below.
<!-- #Include file = "sagecrm.js" -->
<%/*
This ASP displays a list of invoices with the current context company.
Pre-Requisit: 3rd Party invoice table must have a CustomerID equal to Comp_CompanyID
*/%>
<%
// Get the current company ID
var ThisCompany = CRM.GetContextInfo("Company","Comp_CompanyID");
// Call the list block
var Invoices = CRM.GetBlock("Invoice_List");
Invoices.Title = "3rd Party Invoice History";
// Display the list for invoices with a customerID of ThisCompany
CRM.AddContent(Invoices.Execute("CustomerID="+ThisCompany));
Response.Write(CRM.GetPage());
%>