Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming 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