0
votes

In CRM 4.0 we were having button that used to get the XML of all selected records in View using below code. document.all['crmGrid'].gridXml.

The button was available on Contact HomepageGrid and Grid(Advance Find, Left Navigation of parent records GRID Ex: Left Navigation of Account)

I want to pass all records id in view to JavaScript that is being called on button. We used to get the XML using below code.

document.all['crmGrid'].gridXml.

How can we achieve this in CRM 2011 and CRM 2013. We can pass parameter from Ribbon button SelectedControlAllItemIds. This will pass only first 50 records shown in on first page. i want all records in view.

How can we get XML?

1
I Have managed to solve it - user3463768
how ?? :P window.document.all.crmGrid - Dot_NET Pro

1 Answers

0
votes

Ribbon Button code to open all records of **CRM Grid**

var selectedRecords = document.getElementById("crmGrid").control.get_allRecords();
var rowscount = selectedRecords.length;
var FullUrl = document.URL;
if (rowscount >= 1 && rowscount <= 10) {

    var url = "/main.aspx?";    //etc=1;   //&id=";
    url += FullUrl.split('?')[1].split('&')[0] + "&id="
    var tempurl = url;
    for (var i = 0; i < rowscount; i++) {
        tempurl = tempurl + selectedRecords[i].Id + "&pagetype=entityrecord";
        window.open(tempurl);
        tempurl = null;
        tempurl = url;
    }
}