As an JScript newbie, I have a problem with a subgrid in MS CRM 2011.
I have a form with a subgrid and in OnSave of that form, I want to loop over all the rows in the subgrid.
How can I do this with JScript ? Or is it possible another way, ex plugin ?
Thx
You can inspect the subgrid values on save by doing the following:
Doing this on load is a bit more challenging since subgrids are loaded asynchronously and aren't likely to be done loading when the form onload event fires. You can check the grid periodically though to see when it's done loading by calling a function like the following in your form onload:
You can do something like this:
In this case the Xrm.Page.data.entity.getId() get you your current record id and you are looking all the lookups (that are in the sub-grid), you can also add some fields to select more info from them.
Use a Rest call and retrieve the corresponding records :S
Here is the sample code which you can do on save of the form