You can execute this script and any other JavaScript code using the built-in "Developer Tools" in IE8 or by using IE WebDeveloper. First, load the form editor view (CRM displays the form editor UI in its own window). Then press Ctrl+N to open the editor in a window that allows you to get to the IE toolbar. Either press F12 (IE 8 only) or use IE WebDeveloper. Run the script in the interactive script window that's provided in each tool.
document.getElementsByClassName = function(cl,doc) {Here's a snapshot of part of the Account form. After running the script, the display name for each attribute is replaced with the schema name.
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = doc.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
var doc = document.getElementById("contentIFrame").contentWindow.document;
var crmFormFields = document.getElementsByClassName("field",doc);
var crmReadOnlyFields = document.getElementsByClassName("rofield",doc);
if (crmReadOnlyFields.length > 0) {
crmFormFields = crmFormFields.concat(crmReadOnlyFields);
}
var crmFieldId;
var crmFormField;
for (var i = 0; i < crmFormFields.length; i++) {
crmFormField = crmFormFields[i];
if (crmFormField.parentNode.parentNode.parentNode.parentNode.name) {
crmFieldId = crmFormField.parentNode.parentNode.parentNode.parentNode.name;
crmFormField.innerText = crmFieldId;
crmFormField.style.color = "#000000";
}
}