Entity A has whole number field called wholenumber. Entity A also have subgrid. when the new record is created in the subgrid it should fetch the count from subgrid and update it to the wholenumber field. using plugin.
Entity A has whole number field called wholenumber. Entity A also have subgrid. when the new record is created in the subgrid it should fetch the count from subgrid and update it to the wholenumber field. using plugin.
There are two ways you can use it.
1. Add a rollup field into 'Entity A' to replace the whole number field.
2. To achieve it through the plugin, at post-operation of CREATE message of that subgrid record register the plugin. Count all records and then update the whole number field with a total number of associated records from subgrid.
Hi,
Register your plugin on Post create of Subgrid entity -
First retrieve Entity A guid from Target context and then use below.
Now in you plugin logic, you will use fetchxml to find count of the records and then update the count in Entity A.
Subgrid entity will have Entity A lookup.
What if Record is getting deleted from subgrid, do you want to again update the count?
If yes then you may have to write code to do that
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/
without using rollup field .can u suggest me using plugin?
your requirement can be fulfilled using a Rollup field.
Here are some articles which can help you understand about it.
Generic way to Refresh Rollup field in Dynamic CRM - https://vjcity.blogspot.com/2020/03/refreshing-rollup-field-using-javascript.html
Dissecting Rollup Fields in Dynamic 365 - https://vjcity.blogspot.com/2019/06/dissecting-rollup-fields-in-dynamic-365.html
How to change the frequency for rollup field in Dynamic 365 - https://vjcity.blogspot.com/2019/06/how-to-change-frequency-for-rollup.html
Here is how you can create a plugin in Dynamic CRM - Plugin in Dynamic 365 CRM - https://vjcity.blogspot.com/2021/12/plugin-in-dynamic-365-crm.html
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,570 Super User 2024 Season 2
Martin Dráb 228,683 Most Valuable Professional
nmaenpaa 101,148