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 plugin that updates the opportunity product quantity after a bundle is added to opportunity. The first time that the user adds a bundle to opportunity, the plugin's execution takes long time, after this, the time execution is normal. After a short period of user inactivity working with opportunity products the plugin execution takes long time again.
Any idea what is causing this delay during the first plugin execution?
Notice that all plugin's executions are successful. CRM Online 2016
I see this all the time. When a plugin assembly isn't being used CRM unloads it to free up resources. When it's needed again, it spins it up. this is why it's slow at first and after long inactivity, but quick otherwise. There's not much you can do about it besides trying to keep the plugin life alive but I wouldn't recommend that.
Hope this helps! I'd appreciate if you'd mark this as Answering your question.
Thanks for your quick answer.
Any special reason because you don't recommend keep the plugin life alive?
In general, you wouldn't want to keep your assembly alive because it'll prevent CRM from releasing the resources being used. If you have a simple plugin that doesn't do much it may not be a big deal, but with more functionality and larger assemblies it could start to be an issue. There's probably more benefits from the plugin being cleaned up too - if there are any inefficiencies in your code that grow over time, this will get cleared out instead of piling up until it crashed.
So how would you keep a plugin alive? Settings in IIS if you're running on-premise? I just discovered I have the same issue: after a period of inactivity, saving a custom entity record is taking ~2 minutes the first time. If I immediately create a second record, it takes < 5 seconds. That's a huge difference - one my customer can live with, and one that will cause complaints every time.
I'm not positive but I can think of a few things to try. Essentially what you want to do is keep making calls to your plugin so CRM doesn't dump it. A few ways you could try it (and need to test of course):
1) Create a new dummy keep-alive entity. You'd create an async workflow that runs on Create of your entity. When KeepAlive is created, the workflow runs, waits 2 minutes or something, then calls a custom workflow step in your plugin assembly. Your custom workflow step would create a new KeepAlive kicking off the process again. This will be fragile though, because if one workflow fails then you'll have to restart it manually.
2) Add a plugin step to things that get accessed frequently - RetrieveMultiple, or Retrieve of a contact and account. If people are using CRM but not triggering plugins for your assembly, this should help keep the plugin alive longer. It'll still drop off overnight if nobody is on the system though.
3) Have an external service keep alive your plugin. This is like #1, but you have a windows service or Azure service that hits CRM every minute or two and triggers something for the plugin to do. It's more durable than #1 because you control when the service runs, and it's nice to not have to create those workflow, but you have to manage another service running outside of CRM.
Hope this helps!
Thanks for the reply. I'd had a thought of artificially creating something but didn't think it would really fly with the customer and it feels like a workaround. Might be the only way, though. I wish there was documentation on how long before stuff times out, along with a way to specify to keep it alive in some sort of setting. I'm dealing with online, so I understand MS has to balance resources but it's frustrating when something that should take <5 seconds takes almost two minutes. Obviously optimization is a good idea, but when everything is functioning and it doesn't take too long, you figure you don't need to optimize too much.
I have to wonder if there's something that changed recently as far as their data center config and how it handles plugins, because our customer just noticed this and this thread is brand new, making me think that it's fairly recent.
Hi Aiden, I'm experimenting this same issue. The client complains as sometimes the system takes >30 seconds to complete a simple save operation (because this issue about plugin taking a long time).
I can't see how can I explain the client this situation, kind of making the plugin unusable, at least in sync mode.
How can we use plugins as extension of default CRM behavior if it produces this effect? The same issue happens if I use a sync workflow instead a plugin? I can't imagine how can users wait so long, even if the user is the first in the morning
Business Applications communities