Step 3: Create a custom page to display the invoice screen
Use the script below to create a custom page to retrieve the screen you created for individual invoices.
The name of this page must be the same as the entry in Custom File in Step 1: Edit the List object for the invoices table , in this case, Invdetail.asp.
<!-- #Include file = "sagecrm.js" -->
<%
var ThisInvoice;
var InvoiceDetailBlock;
var Record;
var Container;
// Return the value of the field used as the hyperlink to this page.
ThisInvoice = Request.QueryString("InvoiceID");
// Create the block object from the screen block created in CRM.
InvoiceDetailBlock = CRM.GetBlock('Invoice_Detail');
// Find the record using the QueryString returned above.
Record = CRM.FindRecord("Invoices","InvoiceID="+ThisInvoice);
// Pass the record object to the Screen block for execution later.
InvoiceDetailBlock.ArgObj = Record;
Container = CRM.GetBlock("container");
//Add a block to the container.
Container.AddBlock(InvoiceDetailBlock);
// Set the buttons to be displayed in the block.
Container.DisplayButton(Button_Default) = false;
// Write container to screen.
CRM.AddContent(Container.Execute());
Response.Write(CRM.GetPage());
%>
To see the results, open a Company record in Sage CRM, and click the Invoices tab. A list of invoices for the Company record is displayed. The fields that are configured as links are formatted as hypertext.
To open the summary screen for the invoice, click an invoice number.
To return to the list, click Continue.