Adding WebResource to CRM 2011 Header

A customer of ours had a recent requirement to add information to the CRM 2011 header. While I did find some information on the topic, it was difficult to find all the pieces to the puzzle. The following steps should allow you to recreate the same results.

Here is the result…

 

clip_image003

Steps required to accomplish it…

1.) Create Web Resource using the sample code from the Microsoft CRM SDK. You may want to modify the html to format the page the way you want it to look.

http://msdn.microsoft.com/en-us/library/gg327945.aspx

clip_image005

Note:

In the sample HTML page from MS, I made the following changes..

Added – Font size/color for description text.

oTRowTD00.style.color = "#818A96";
oTRowTD00.style.fontSize = "11px";
oTRowTD00.style.fontFamily = "Segoe UI";

Added – Font size/color for result text.

oTRow1TD01.style.color = "#000000";
oTRow1TD01.style.fontSize = "14px";
oTRow1TD01.style.fontFamily = "Segoe UI";

2.) During onload of form use FetchXML to get data and pass it to the new web resource you created and pass results to the following JS

//Sample data

var HeaderData = ‘’;

HeaderData = "?data=DBA%3d" + sDBA + "%26Address%3d" + sAddress + "%26City/State/Zip%3d" + sStateZip + "%26Phone%3d" + sPhone + "%26City%3d" + sCity;

document.getElementById("WebResource_Test").src = document.getElementById("WebResource_Test").src + HeaderData

Note: The following two objects did NOT work when referring to web resources in the header. One object only works against resources in the body. The other object I tried just kept saying it doesn’t exist:

Xrm.Page.ui.controls.get("WebResource_Test") – Only works in body

Xrm.Header.ui.controls.get("WebResource_Test") – No documentation and Null results

Post by: Sean Shilling, Customer Effective

Show Buttons
Hide Buttons