Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

dynamics 365 crm plugin time out issue

Posted on by 185

Hi,

I have a synchronous plugin registered on a create of custom entity.That custom entity record gets created from other external system(they are connecting to CRM organization service and creating record. This record holds a json string ). Once the above record gets created, my plugin gets triggerred and read through json object and updates opportunities.

The whole above mentioned process works perfectly fine in DEV. But in UAT it's throwing plugin 2 mints max time out error. The json string has 1200 records ( i don't think it's big number). Also, when I just push a json string having 1 record to UAT, it works fine.

My doubt is , why UAT instance getting time out ? why not in DEV ? Why UAT organization service responding very slowly ?

Can I increase plugin time out using ( crmServiceProxy.Timeout = new TimeSpan(0, 5, 0) ) ? The only other option I have is custom workflow ? Does the custom work works fine in Online version without any time out issue ?

Thanks In advance !!

*This post is locked for comments

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: dynamics 365 crm plugin time out issue

    Json is a Async operation. It is better to move to workflow Activity.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: dynamics 365 crm plugin time out issue

    Hi,

    Create multiple records within the plugin (Synchronous) is never a good idea. You never know in future if the same plugin will continue to work as the number of records to be created will increase so is the size of the current database which will impact the retrieval of records as well.

    These type of requirements are best to be achieved by using either any of the third party tool like scribe which contiguously pulls the data or by writing your own scheduler.

    Hope this helps.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: dynamics 365 crm plugin time out issue

    Hi

    On top of what others suggested, I would recommend you check your code, it could be that your code is accessing some URL to perform actions and if for some reason if the HTTP client does not timeout before plugin does, you migt get this error. In other words, your plugin code might be trying to access some service but the URL is invalid or the service it's accessing taking longer than plugin timeout time.

    One other possibility is that if there are any infinite loops in your code or delay or Thread.Sleep steps, it might be taking longer as well.

  • Jim Daly Profile Picture
    Jim Daly on at
    RE: dynamics 365 crm plugin time out issue

    If you want to know more about this particular plug-in and how it is working, you can to instrument you plugin code and add timestamps for each record processed. 

    Use the tracing feature described here: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/logging-tracing

    Then after the plugin fails with 2 min timeout you can see the logs in plugin traces (which you will have to enable to log ‘all’ data) and figure out where the time is spent.  The update of opportunity could be firing more plugins downstream so those will add up to the time.   All this you can figure out by instrumenting plugins as a first step.

    As called out by others, some operations shouldn't be done synchronously. Although the timeout is 2 minutes, you really shouldn't consider a synchronous plug-in that can't complete in a matter of seconds. You have to share that timeout period with every other timeout that is registered for that event AND all the other subsequent synchronous plug-ins that could be triggered by your code. There are some things you shouldn't attempt with synchronous plug-ins.

    More information: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/scalable-customization-design/overview

  • Suggested answer
    RE: dynamics 365 crm plugin time out issue

    If your plugin is timing out then most probably you are doing it wrong or not following the best practices.

    Change your plugin step to PostCreate - Asynchronous.

    Ideally you should go ahead with Synchronous only if it completes in under 3-4 seconds. Not more than that.

    Reason why your plugin would have worked in Dev and not in UAT: Generally, data in Dev is very small compared to UAT instances.

    Another solution which I can think for your scenario is Microsoft Flow. It is totally No-Code solution. you can trigger the flow on Create of the entity , retrieve the Required Opportunities and loop through them and Update them.

    Try it out here https://flow.microsoft.com

    Please provide your feedback if this answer solved any of your problem or gave you any direction.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: dynamics 365 crm plugin time out issue

    Hi,

    There is no supported way to increase timeout for plugin   ,Slowness issue  could be for many reason. You can raisec ticket to MS for that.

    However for safe side I would recommend to go for custom workflow activity to avoid timeout issue.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans