This example shows how it is possible to pass variables from CRM to an external website and then embed the returned results into a page structure controlled by the standard CRM blocks.
You can see the page below has the standard tab group, the notifications and onscreen coaching surrounding the information from the external system. In this case the company name has been passed to the search engine to pull back the information needed.
The code that created this looks like:
//Get Context Info to pass to the external site
var strName = eWare.GetContextInfo("company","comp_name");
var xml, text
//Instantiate the Object to carry out the XML request.
xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
var strURL= "http://search.bbc.co.uk/cgi-bin/search/results.pl?tab=web&go=homepage&scope=all&q="+strName+"&Search.x=43&Search.y=24"
xml.open("GET", strURL, 0);
var text = String(xml.responseText);
var myBlock = eWare.GetBlock("content");
myBlock.contents = text;
var myBlockContainer = eWare.GetBlock("Container");
DisplayButton(Button_Default) = false;
xml = "";
You will need to consider the following:
- You will have to handle the HTML returned as a string and strip out unwanted elements.
- You may need to override style guide information.
- You will need to check hyperlinks and correct them where necessary.
- You will also need to ensure that you satisfy the terms of service for the external website. For example see http://www.google.com/terms_of_service.html