In my last blog post, I outlined how to display data from external database in SageCRM 200. This week, I'm going to do the same thing, but instead of connecting to an external datasource through SageCRM, I'm going to display the data using a custom ASP page. If you recall from my last post, we had to create a view so that we could include the required channelID field to be able to display the data in the Team CRM area. One of the benefits of using a custom ASP page is that we can pull directly from the source table without having to add additional data elements. Also, we have the ability to display this view almost anywhere in SageCRM. With the other process, we couldn't add the page to Companies (for example) without establishing a relationship between the external data and company data.
First of all, we need to create a simple ASP page displaying the information we wish to see. I'm going to pull in the same data as I did in my last example:
conn.Open"Provider=SQLOLEDB;UID=sa;PWD=CFXPASS;Data Source=crmDev;Initial Catalog=Northwind;"
set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT orderdate, requireddate, shipaddress, shipcity from Orders"
rs.Open sql, conn
<table border="1" width="100%">
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
<%do until rs.EOF%>
<%for each x in rs.Fields%>
Save this file as "Northwind.asp". Once the file is saved, it needs to reside in the CustomPages folder of the CRM installation. Typically, this is found in "...\CRM\InstallName\WWWRoot\CustomPages".
Now that the asp page is saved and in the correct location, go to the same location we added the other Northwind tab. This was under Administration->Advanced Customization->System Menus. Once there, edit the "Channel" tab group to add the new tab.
Set the following properties:
- Caption : in this case "Northwind Orders ASP"
- Action : Set this to customfile. This will let SageCRM know that this a file in the CustomPages folder
- Custom File : Enter the name of the custom ASP page. (Northwind.asp)
Click Add and then Save to add the new tab. That's all there is to it!
This isn't meant to be an ASP tutorial, so the formatting is pretty simple. However, you can see how simple it is to add a custom ASP page to Sage CRM.
Thanks for reading!