Hi All,
I want to get the total no of records in subgrid on page load and when
any record gets added to subgrid. Dynamics CRM(8.2 online)
Best Regards,
Shahbaaz
*This post is locked for comments
Hi shahbaz,
No it is not deprecated you can find it in version 8.2 sdk message excel.
If the relationship is n: n then use this otherwise create and delete message on sub grid entity will work.
Hi nodal,
Associate and disassociate message has been deprecated from crm 2013(please correct me if I'm wrong).
Thanks,
Hi Shahbaaz,
Can you try a single plugin on association and disassociation message to populate both count and other operation you want to do on count field change.
Regards,
Nodal
Yes thats correct. In this case, please use Javascript!
Thanks for the suggestion, i want to trigger plugin as soon as the i add record in subgrid, will it work with rollup field? because rollup fields are calculated via an Async Process so this might take time.
Hi Shahbaaz ,
You can call REST API , to get the subgrid data using entity id , I think this is better way to get the total record count .
Above code is fine. However, unlike Calculated fields, you can trigger a plugin on a rollup field. So its up to you if you want to use a rollup field or the javascript :)
Thanks Rawish for the response, i wanted to do it using javascript because i wanted to update a field value and trigger plugin, that wont work with rollup field(please correct if i am wrong).
I have used below code on page load to get the count of the subgrid using javascript and set timeout so when ever any record gets added to it, it will update the field.
NOTE : i tried "Xrm.Page.getControl("ZipcodeGrid").getGrid().getTotalRecordCount();" code on editable subgrid and it was not working so i posted the question, then i removed the editable subgrid and used nornal grid and it was working with this code "Xrm.Page.getControl("ZipcodeGrid").getGrid().getTotalRecordCount();"
Hope this helps someone!!!
//below is the function
function GetGridCount()
var zipcodeSubgridCount = Xrm.Page.getControl("ZipcodeGrid").getGrid().getTotalRecordCount();
Xrm.Page.getAttribute("ewt_subgridcount").setValue(zipcodeSubgridCount.toString());
setTimeout("GetGridCount()", 5000);
}
How about you use a simple rollup field to count child records?
community.dynamics.com/.../count-the-number-related-child-records-using-a-rollup-field
let me know if its something you aint looking for.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Aric Levin - MVP 2 Moderator
MA-04060624-0 1