This is the eighth article in a series that discusses creating a new database connection to the Sage X3 database using the standard Sage CRM features.

Sage CRM provides the sales, marketing and services modules for the global business management solution, Sage X3.  Together these make a complete front and back office solution that is faster, simpler and more flexible system than a typical ERP system.

I discussed in the previous article "Extending the Sage X3 Integration (Part 7)" a functioning simple Search screen allowing data from the Sage X3 system to be retrieved from within the Sage CRM interface can be created and then added to the interface using RunBlock.

This article will look at using the .NET and classic COM ASP APIs to create more sophisticated screens.  The development of application extensions using either ASP pages (with the COM API) or the .NET API shares certain features as both allow Sage CRM to communicate directly with Sage X3 database and because of this there has to be 'foreign key' linkage between the systems.

Note:  Both the .NET and ASP COM API provide full CRUD capabilities over the tables of an external database table linked into Sage CRM. However you must only design extensions for viewing data. You must not attempt to directly edit or insert data into the Sage X3 database tables as this would potentially break data integrity and business rules in Sage X3. Any updates to the Sage X3 data should use the web services of Sage X3. It is possible to design edit/insert screens using Sage CRM screen definitions but have these redirected to the web services that will handle the data manipulation safely in Sage X3.

Development with either the .NET API or ASP pages is fast. The Sage CRM Meta Data and concept of blocks would allow the data in the Sage X3 to be presented within the Sage CRM interface.

Below is a screen that shows an page displaying Serial Number information from the Sage X3 tables 'STOSER' The page has been called in the context of an Account in Sage CRM and the view used to retrieve the data has the BPCNUM_0 field included so that the data can be restricted to context. The "BPCNUM_0" field is joined to the "acc_int_reference" field.

This page was built using an ASP page written in JavaScript.

[code language="javascript"]
<!-- #include file ="../sagecrm.js"-->
var intRecordId = CRM.GetContextInfo("account","acc_int_reference");
var Arg = "bpcnum_0='"+intRecordId+"'";
var listBlock = CRM.GetBlock("SERIALNUMBERS");
var filterBlock = CRM.GetBlock("SERIALNUMBERFILTER");
filterBlock.Title=CRM.GetTrans("tabnames","search");
filterBlock.Newline = false;
var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(listBlock);
AddBlock(filterBlock);
}
listBlock.ArgObj = filterBlock;
CRM.AddContent(myBlockContainer.Execute(Arg));
Response.Write(CRM.GetPage("Account"));
[/code]

You can then use the standard ASP and .NET API to allow for drill down from the lists to display summary screens as needed.