Skip to main content

How to modify header of CRM entity form

CRM single-record form always displays the same word 'Information' in the header area below entity name. This area can be reused to display something more meaningful about the record using simple script below:

var headerElement = document.getElementById("leftNavBreadcrumbText");

if (headerElement != null) {
//Can change style in any way
// headerElement.style.color = [Select color];
headerElement.innerHTML = 'More info about this record...';
}

Comments

Popular posts from this blog

Making any text field on CRM form look and behave like a hyperlink control

Some CRM form fields behave by default like hyperlinks. If you need to add a custom attribute to a CRM entity and display it on the form making it look like a hyperlink, this code is one way to do it:

var urlField = crmForm.all.myfield;

//Set the text color to blue
urlField.style.color = 0x0000ff;

//Display the text underlined
urlField.style.textDecorationUnderline = true;

//Use the hand cursor
urlField.style.cursor = "hand";

//Add the ondblclick (or onclick) event handler to open target site in a new window
urlField.ondblclick = function() {
//Get the url from value in the field
var url = urlField.DataValue; // Or get it from somewhere else

//If the url is not empty
if (url != null && url.length > 0) {
window.open(url, "_blank");
}
}

Enable more than 8 tabs in CRM form

Some of CRM settings look to be spontaneous rather than designed; one of them is restriction of maximum number of tabs on CRM form to 8 tabs only. It crops up in every other project when someone just has to have a form with lots of tabs.

Turns out you can easily change it by modifying form editor code file: open to Tools\FormEditor\formeditor.aspx (path in CRM 4.0) and change
var _iMaxTabs = 8;
to some other number.

That's it; it'll work both in CRM 3.0 and 4.0. Should've been a configurable parameter really.

Hiding toolbar button on CRM form

To hide the button, you'd need to find the control name, one way to do it is by simply looking through rendered HTML. Hit CTRL-N when the form is open to open it again, with IE menus and toolbars and view source. Find your button. Hide it using similar code:

var buttonID = "ISV_New_1_2_ConverttoEvent";
var theBtn = window.document.getElementById( buttonID );
if (theBtn != null) {
// ... do whatever to determine hide/show state
theBtn.style.visibility = "hidden";
}