locked
CRM 2013 - Count records from a grid RRS feed

  • Question

  • Hello , 

    I would like to count the records from a grid . 

    I found a lot of JS on the internet but none of them working . 

    I would like to count the records from a grid that is on the Campaign form . 

    The name of the grid is Activities . 

    I found the fallowing formula, but is not working . 

    function GetSubGridCount2013() {
    //SubGrid Name
    var gridName = "Activities";
    var spanList = document.getElementById("Activities").getElementsByTagName("span");
        for (var i = 0; i < spanList.length; i++) {
            if (spanList[i].id != null && spanList[i].id == "Activities")
                alert(spanList[i].innerText);
    }

    OR THIS ONE : 

    function GetSubGridCount2013() {
    //SubGrid Name
    var gridName = "Activities";
    var grid = $find("<%= +"gridName +".ClientID %>"); 
        var len = grid.get_masterTableView().get_dataItems().length; 
    alert(len);
    }

    none of them is working .

    What i am mistakeing ? 

    Tuesday, August 26, 2014 1:46 PM

All replies