Adding WebResource to CRM 2011 Header

Visit Website View Our Posts

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…



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.



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

Added – Font size/color for description text. = "#818A96"; = "11px"; = "Segoe UI";

Added – Font size/color for result text. = "#000000"; = "14px"; = "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