Tags

CRM & Technology Management


Sales and Marketing Advisor


Sign Up For the Newsletter

Login

Welcome to the Technology Advisors Blog!!

Technology Advisors CRM and Technical Information
Jul 26
2011

How to pull data from a sub-grid on a parent form in MSCRM

Posted by: Administrator in MyBlog

Administrator

In Microsoft Dynamics CRM 2011 it is possible to pull data from a sub-grid on a parent form when a page loads to read the values.

Place the script below inside a Web Resource and call the function "calcPortfolio" on a "OnLoad" event

function calcPortfolio()
{
                var portAmount = 0.00;
                //name of the sub-grid
                var gridControl = document.getElementById("SubGridName").control;                 var ids = gridControl.get_allRecordIds();                 for(i = 0; i < ids.length; i++)                 {                                               var cellValue = gridControl.getCellValue('SubGridField', ids[i]);                                 // cellValue has a datatype of Currency
                                cellValue = parseFloat(cellValue.replace(/[$,]+/g,""));                                 portAmount = portAmount + cellValue;
               }                 var Name = Xrm.Page.data.entity.attributes.get("fieldOnParentForm");
                Name.setValue(portAmount);

}

Hits: 3503
Comments (0)Add Comment

Write comment
smaller | bigger

security code
Write the displayed characters


busy