Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 2Check out the latest updates and new features of Dynamics 365 released from October 2022 through March 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
We have an entity which holds 3 types of Records A, B, C. Record type A is the parent of B (each A can be the parent to multiple B records) and further B is the parent of C (each B can be the parent to multiple C records). On creation / update of every record C, CalculateCommercials plugin will run that will pull all the sibling C records under a given record B and aggregate / roll-up the totals and update that parent record B with those rolled-up sum / totals. Same thing happens on update of B record totals which will roll-up the totals to grand-parent A record. The problem here is, when we create/update multiple C records under a given parent B this will trigger multiple CalculateCommercials plugin instances which is a bit inefficient & resource intensive. Is there a better approach where we let the CalculateCommercials to trigger only once irrespective of the number of C records being created / updated?
For example, if we create / update 10 C records at a given time (roughly in a 3 minute interval) we want the CalculateCommercials plugin to run only once which will roll-up the totals to B and again only once to update A, instead of 10 times (currently its triggering 10 CalculateCommercials plugin instances to roll-up to B, which in-turn trigger another 10 more instances to update grand-parent record type C).
Sometimes this chain of auto-triggers resulting in the exceeding of 2 minute time limit for the plugin instance. Is there a better approach to simplify the rolling up of totals to parent B and then on to A?
Just thinking out loud here, but it seems like you need to define what "at a given time" means. 10 milliseconds? 1 minute? 1 Hour?
So, if you are going to update those 10 C records withing a 10 second time period, then what you need to do is add a 10 second "cool down" period before the calculations start. And then only roll up the calculations once for all of the C siblings, which then fire off the calculation for B and then A.
Additionally, you could add some type of tracking mechanism to see if any of the children or grandchildren of A have been updated within X amount of time. If so, then start the C->B->A calculations
Hi Rod, I've updated the question, the time interval that I'm talking about could be around 2-3 minutes.
So, there are a couple ways to approach this, and here is one idea (I am sure there are better ways than this). Set up a hidden "isDirty" variable/field for each of those A, B, C records. When they change then plugin 1 sets "isDirty" is true for that record and the "higher" (B and A) records. Then if there are no other cooldown timers running then it sets up a timer that is just under 2 minutes (the plugin timeout limit), and at the end of that timeout then it fires off the 2nd plugin that does the rollup calculations, but only for the fields that are dirty.
That way it only does the calculations once for each field that is dirty.
Alternatively, instead of setting up a cool down timer you could have plugin 1 do the same "isDirty" work with no timer. And then every 2-3 minutes you set off another plugin that does just the rollups.
Again, I am sure there are smarter/better ways to do this.
Business Applications communities