web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Delaying the Step Execution of a Plugin

(0) ShareShare
ReportReport
Posted on by 11,323

Hi,

I have a Plugin which triggers on an update of a field. The field gets updated around midnight by the SYSTEM and a lot of records get updated around the same time. This causes my plugin to act strangely and I would prefer if I could Delay the execution of my plugin to around 5 mins after the field has been updated as my plugin works 100% when I update the field manually.

Is this even possible?

*This post is locked for comments

I have the same question (0)
  • Guido Preite Profile Picture
    54,086 Moderator on at

    what do you mean by "act strangely"? or the plugin works or the plugin doesn't work. what the plugin is doing? the fact that doesn't work is caused by many records updated at the same time? (for example you are doing a retrieve multiple and get a not exact total count?)

  • Suggested answer
    Community Member Profile Picture
    on at

    You can use a background workflow instead. There you can apply waiting of 5 mins and then run the code.

  • David Jennaway Profile Picture
    14,065 on at

    As per the previous post, maybe using a workflow with a wait is an option. If all instances have a 5 minute wait, they may all start processing at the same time, so the benefit would be from running this asynchronously, rather than the delay.

    It may be simpler to just have your plugin run asynchronously. In most cases this won't affect your code, though you would need to change the code if it runs on a pre-step, or if you rely on changing the OutputParameters

  • Community Member Profile Picture
    on at

    The most is to set the plugins as async plugins, but that won't guarantee the 5 mins interval. If your plugins is not time critical, try change it to custom WFA and add it as a step after some timeout condition in the same workflow.

    What could be the use case? To make it scalable of course batch job will be better solution.

  • ashlega Profile Picture
    34,477 on at

    Hi Thomas,

     I think you'll need to dig into "why" it acts strangely rather than into how to delay it. Chances are, it will start acting strangely again 5 minutes after midnight if you don't figure out the reason why..

  • Suggested answer
    Indika Abayarathne Profile Picture
    671 on at

    If you have very large number of records to trigger a plugin at the same time, you will end up with a timeout. It will trigger the plugin for very first set of records but others will get failed.

    5 minutes delay will not be a good option as even after 5 mintutes you will face the same issue.

    I am also thinking of a batch process to perform the plugin's job.

  • ashlega Profile Picture
    34,477 on at

    It might not be 100% correct.. I think the majority of those timeout issues are caused by all sorts of database locks which may happen in the plugins when lots of them are running at the same time (one plugin will update a record, another one will need to read from it.. something along those lines). It's not just the number of plugins that's causing the timeouts

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans