Thursday, 19 January 2012

Show all sub grids data in CRM 2011 entity form (More then 4+ Sub grids)


In CRM 2011, Due to performance reason only four sub grids shows data and other sub grids will show data when we will click on "To load entity records - click here" link button
But some time we need to show all sub grids data and in this article I am going to explain , how we can show all sub grids data
With the help of little JavaScript code we can show all sub grids data.


function loadsubgrids() {
var _clsname = 'ms-crm-List-LoadOnDemand'
    var _body = document.getElementsByTagName("body")[0];
    var _arr = [];
    var _regexp = new RegExp("\\b" + _clsname + "\\b");
    var _lnks = _body.getElementsByTagName("a");

    for (var i = 0, j = _lnks.length; i < j; i++) {
        if (_regexp.test(_lnks[i].className))
            _arr.push(_lnks[i]);
    }
    for (var i = 0; i < _arr.length; i++) {
        _arr[i].click();
    }
}


Put this JavaScript code on form "onload" event, in this JavaScript code I am finding "To load entity records  - click here" link class name (To check class name of link use IE developer tool”) and forcefully executing its click event

No comments:

Post a Comment

Note: only a member of this blog may post a comment.