Async vs Synch Plugin usage question RRS feed

  • Question

  • Hi, When will be good to use Synch vs Asych Post Operation Plugin in CRM 2011 Online? I have few custom entities, depedning upon the value entered in child entities, we want to reflect the totals in parent entity. Say Entity Parent, entity Child.. There can be several child records owned by many users. There is a field Miles Driven for today,  Say if 5 users enter 10 miles each for a given day, as they enter the Miles, I want to reflect the total as 50 at the Parent level. So the supervisor know without summing them all;  

    If I use synch post Update plug-in, then it may take few sec to calculate the total and during that time it holds the screen for the user. This is fine but there are many other users say 50 that may use our system. In that case, I am afraid the performance may be a bottleneck. In that case, could I use the Asynch? If so, will it reflect the total on the Parent Entity?

    I would like to know how others in the forum have approached such scenario. Thanks for your feedback.  



    Wednesday, October 5, 2011 10:44 PM


  • I don't think that having 50 users will really make a noticeable difference on the time it will take your plugin if it executes synchronously, because there are multiple sandbox processes that can handle requests and it is unlikely that all 50 users trigger the plugin at the exact same second. However, here are some things you might want to consider to decide which approach to use:

    • Sync plugins will block execution so like you mention, users will experience a slight delay while your plugin executes. If this delay is acceptable you might want to stay with sync plugins.
    • Do you need the update to happen immediately and inside the same transaction? If so, you have no choice, you have to use sync plugins. Otherwise if you can afford some delay then you can switch to async plugins.
    • If the plugin fails, an async plugin will fail silently and is hard to detect that a failure occurred. On the other hand, if the plugin is sync, it will show an error to the user so the user can retry the operation.
    • Both sycnc and async plugins have a timeout of about 2 minutes, I think you should be fine with this.
    • If your plugin takes longer than 5-10 seconds to execute then you should move to async for the sake of user experience.


    Additionally you might consider if using a workflow. This post can give you good guidance to decide: http://gonzaloruizcrm.blogspot.com/2011/06/plugin-workflow-or-dialog-in-crm-2011.html

    Gonzalo | gonzaloruizcrm.blogspot.com

    Wednesday, October 5, 2011 11:50 PM