Monday, October 19, 2015

Change Tab Order in CRM

Default tab order in CRM is top to bottom, if we want to change it and suppose we have lots of field in form then use below function and call it on OnLoad().


TabOrderLefttoRight: function () {
for (var i = 0; i < Xrm.Page.ui.controls.getLength() ; i++) {
var control = Xrm.Page.ui.controls.get(i);
var element = document.getElementById(control.getName());
if (element.tabIndex && element.tabIndex != "0") {
if (element.className == 'ms-crm-Hidden-NoBehavior')
continue;
if (element.tagName == 'A') {
if (element.className != 'ms-crm-InlineTabHeaderText')
continue;
}
element.tabIndex = 1000 + (i * 10);
}
}
},