Friday, 2 August 2013

Code to Get the Sub grid row values in Mscrm 2011


    function GettheSubGridRowValues() {
   

       // Get the Grid conrttol using its name
      var  grid = document.getElementById("Events");
      // Chek the grid is loaded or not
       if (grid.readyState != "complete") {
        // delay one second and try again. to wait  for grid loading 
        setTimeout(SubGridRefresh, 1000);
        return;
    }
    if (grid) {
         var gridControl = document.getElementById("Events").control;
        //Get the Row ids 
         var  ids = gridControl.get_allRecordIds();
         var  IslogicExecutionRequired= false;
        //Iterate by row wise
        for (i = 0; i < ids.length; i++) {
              // Get the call value by its column name
            var cellValue = gridControl.getCellValue('sci_name', ids[i]);
             if (cellValue == "xxxxx") {
                  IslogicExecutionRequired= true;
            }          
        }
   
    }
}

No comments:

Post a Comment