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.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
I have a requirement to update all Contacts (50 000 of them) in my Dynamics CRM 2013 once a month. For each Contact I need to calculate new values of certain fields (statistics of that Contact's behavior over the last month).
Currently I have a custom plugin, which fires separately for each Contact - so there are 50 000 plugin executions. This is terribly slow and takes many hours to complete.
Is there a way to perform these calculations in one execution of the plugin? E.g.
What solution would you recommend to handle this requirement in an efficient way? Thank you
I would recomment to create Console Application and schedule it in Task scheduler on Server to run every month.
Console application should fetch All contacts based on your filter criterial, perform calculation and update contact.
You can easily accommodate plugin code in your console application. Only thing you would need to do to fetch contact records using fetchxml or queryexpression.
On top of what Bipin already mentioned, you can make use of ExecuteMultiple to batch your updates if you are not already doing so.
If you have 50k records, you will only be doing 50 000/1000 = 50 bulk updates rather than doing 50k individual update requests. This might make your updates faster. Perhaps, you could actually update your plugin code to use execute multiple and see if that improves the performance.
Some links related to Execute Multiple
I would also suggest you register the plugin as Async so that the plugin runs in the background and does not hold up the UI.
Update : One other thing to keep in mind is that when you retrieve all 50k records, make sure you only pull the columns you need. If you retrieve every single columns value, you might end up with out of memory error or the plugin or console app might crash if the server does not have enough memory.
Hope this helps
Business Applications communities