locked
Chrome Browser is not getting the GetRecordsFromInnerGrid().Length, but it is working in IE Browser RRS feed

  • Question

  • Hi All,

    Can you please suggest me  arrx always showing undefined in Mizilla and Chrome Broswers.

    function RetrieveSubGridRecords() {
        var Hasclaimed;

        if (document.getElementById("m_members")) {
            var grid = document.getElementById("m_members").control;
            var arrX = new Array(grid.GetRecordsFromInnerGrid().length);

            for (var rowNo = 0; rowNo < grid.GetRecordsFromInnerGrid().length; rowNo++) {
                for (var cellNo = 3; cellNo < grid.GetRecordsFromInnerGrid()[rowNo][3].cells.length; cellNo++) {
                    arrX[rowNo] = grid.GetRecordsFromInnerGrid()[rowNo][3].cells[3].outerText;
                }

            }
            if (arrX[0] != null) {
                if ((arrX[0] == "Yes")) {
                    Xrm.Page.getAttribute('claim').setValue(110090001);
                }
                else {
                    Xrm.Page.getAttribute('claim').setValue(110090000);
                }
            }
            if (arrX[0] != null && arrX[1] != null) {
                if (arrX[0] == "No" && arrX[1] == "No") {
                    Xrm.Page.getAttribute('claim').setValue(110090000);
                }
                else if (arrX[0] == "Yes" && arrX[1] == "Yes") {
                    Xrm.Page.getAttribute('claim').setValue(110090001);
                }
                else {
                    Xrm.Page.getAttribute('claim').setValue(110090002);
                }
            }
            if (arrX[0] != null && arrX[1] != null && arrX[2] != null) {
                if (arrX[0] == "No" && arrX[1] == "No" && arrX[2] == "No") {
                    Xrm.Page.getAttribute('claim').setValue(110090000);
                }
                else if (arrX[0] == "Yes" && arrX[1] == "Yes" && arrX[2] == "Yes") {
                    Xrm.Page.getAttribute('claim').setValue(110090001);
                }
                else {
                    Xrm.Page.getAttribute('claim').setValue(110090002);
                }
            }

            if (arrX[0] != null && arrX[1] != null && arrX[2] != null && arrX[3] != null) {
                if (arrX[0] == "No" && arrX[1] == "No" && arrX[2] == "No" && arrX[3] == "No") {
                    Xrm.Page.getAttribute('claim').setValue(110090000);
                }
                else if (arrX[0] == "Yes" && arrX[1] == "Yes" && arrX[2] == "Yes" && arrX[3] == "Yes") {
                    Xrm.Page.getAttribute('claim').setValue(110090001);
                }
                else {
                    Xrm.Page.getAttribute('claim').setValue(110090002);

                }
            }

        }
        else {
            setTimeout("RetrieveSubGridRecords();", 2500);
        }


    }

    can you please suggest me  arrx always showing undefined in Mizilla and Chrome Broswers.

    Monday, January 4, 2016 4:56 AM

All replies

  • You don't mention what version of CRM you are working with, or if it is online or on-premise.  

    In any case, your issue may be that using any document.getElementById calls are not supported because of how CRM is drawing controls, even more so with the newer builds and enhanced turbo forms.

    If it's a recently updated Online version, you can take a look at this article about supported methods to work with sub grid data:  https://msdn.microsoft.com/en-us/library/dn932137.aspx

    Good luck!

    Tuesday, January 5, 2016 8:46 PM