When we started to look at the security matrix for the system and it became a nightmare to set the privileges on the security roles as CRM does not sort the custom entities alphabetically.
I found a solution where add sorting to custom entities tab in security roles.
Locate the file called edit.aspx located at:
\Program Files\Microsoft Dynamics CRM\CRMWeb\Biz\Roles\edit.aspx
Add the following code in bottom of the page:
<script type="text/javascript">
var tbl = document.getElementById('tab7').children(0).children(0).children(0).children(0).children(0);
var x = [];
for (var i = 0; i < tbl.rows.length; i++)
x[i] = [tbl.rows[i].cells[0].innerHTML,tbl.rows[i].outerHTML];
var str = x[0][1];
for (var i = 1; i < x.length - 1; i++)
for (var j = i + 1; j < x.length; j++)
if (x[i][0] > x[j][0]) {//sort by alphabet
var tmp = x[j];
x[j] = x[i];
x[i] = tmp;
}
for (var i = 1; i < x.length; i++) {
var rows = x[i][1];
if ((i % 2) != 0) {//background color for odd number rows
if (rows.indexOf('<TR class=on>') > -1) {
rows = rows.replace('<TR class=on>', '<TR>');
}
}
else {//background color for even number rows
if (rows.indexOf('<TR class=on>') < 0) {
if (rows.substring(3, 5) == 'TR') {
rows = rows.replace(rows.substring(3, 5), 'TR class=on');
}
}
}
str += rows;
}
document.getElementById('tab7').children(0).children(0).children(0).children(0).innerHTML = '<TABLE class=ms-crm-Form-Area onmouseover=SetAltText(); ondblclick=ProcessClick(); onclick=ProcessClick(); cellSpacing=0 cellPadding=2><COL><COL width=70><COL width=70><COL width=70><COL width=70><COL width=70><COL width=70><COL width=70><COL width=70>'+ str + '</table>';
</script>
Note:
- This is unsupported. Please do backup before editing.