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)

Plugin timeout exception in custom workflow activity

(0) ShareShare
ReportReport
Posted on by 1,196

Hi All,

I have written custom workflow activity - logic is to fetch account and create opportunities for them automatically. Here, the fetched records are 1000+ and the creating opportunities process takes a lot of time.

So i have opted to write plugin instead custom workflow activity but still here too i get the same plugin timeout exception of 2mins in the workflow also. The crm is online which i am using.

Any thoughts on this if anybody encountered the same ?

172780.Capture.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at

    Hello,

    All custom code components (plug-ins , custom workflow activities) have a maximum execution time of 2 minutes in Dynamics 365 (CRM) Online, there is no going around it.

      

    For heavy duty, long running jobs, it's recommended that you off-load the work to another service, like an Azure Function or an Azure WebJob. You can register a Service Bus connection or Event Hub to Dynamics 365 so it'll start queueing up entities that need processing in another service.

      

    Here are some articles to get started in including Azure as a worker process:

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/work-event-data-azure-event-hub-solution 

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/write-listener-application-azure-solution 

    And here are some sample code articles:

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/sample-code-azure-integration 

      

    Hope this helps you get started. If you have any other questions, please let me know!

    If you found my answer helpful, please help the community by marking it as verified :-)

  • Pranesh M Juwale Profile Picture
    1,196 on at

    Hi Michel,

    Thanks for the reply. Any cost estimates idea if i approach with the Azure ?

    Regards,

    Pranesh

  • Suggested answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Pranesh,

    Your plugin will get stopped after 2 min of execution. For updating/creating 1000+ record it will take time, so better is to write a console application. also you can use execute multiple for updating/creating which will update/create 1000 record in single service request.

    If you find it helpful, Please mark as Verified.

    Thanks,

    Shahbaaz

  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at

    Hello Pranesh,

    Cost wise really depends on how heavy your jobs are. The beauty of Azure Functions is that you only pay for the CPU time you actually use, so the costs should be relatively manageable, unless you are constantly run jobs there full time.

      

    The is current set at:

    • Execution Time: US$0.000016/GB-s
      • (Functions are billed based on observed resource consumption measured in gigabyte seconds (GB-s). Observed resource consumption is calculated by multiplying average memory size in gigabytes by the time in milliseconds it takes to execute the function.)
    • Number of Executions: US$0.20 per million executions (one whole job run, where you create 1000+ records counts as 1 execution)

    Better and more detailed pricing can be found here:

    https://azure.microsoft.com/en-us/pricing/details/functions/

     

      

    A dedicated Azure WebJob provides a more stable cost component, for a simple job you could easily use a Standard S1 plan, which comes at approx US$73.00/month for 1 CPU Core and 1.75GB of RAM

    Please take a look at the Azure Pricing Calculator, which knows these numbers better than me

    azure.microsoft.com/.../calculator

      

    Hope this helps you get started. If you have any other questions, please let me know!

    If you found my answer helpful, please help the community by marking it as verified :-)

  • Pranesh M Juwale Profile Picture
    1,196 on at

    Any other workarounds where we can create records batchwise instead all at a time .

    Anybody ?

  • Michel van den Brink Profile Picture
    4,697 on at

    Hello Pranesh,

    Sorry, there's not reliable work-around within Dynamics 365. The maximum execution time-out is there to protect the system from being overloaded by custom code execution.

    If the Azure costs are a determinant, you can always go for the Console App option that Shahbaaz mentioned. You can host that anywhere, including on-premise.

  • Suggested answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Pranesh,

    As i mention above, you can create a console app/Scheduler which will run every day at a fix time and will get all the account for which you need to create opportunity.

    Also you can use ExecuteMultiple Request for this.

    Best Regards,

    Shahbaaz

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi  Pranesh ,

    The execution time of plugin , workflow  can be depends on many things like how many user accessing , Network performance , How much data you are processing at  a time , how busy your CRM system etc etc.

    So now if you compare synchronous plugin and synchronous custom workflow both are executing in the stage 30 of event execution pipeline however for custom workflow its executing using workflow transaction layer. So compare to workflow plugin is  faster irrespective of above criteria.

    So now if you are still getting time out error this is due to synchronous plugin execution time maximum 2 minutes . So now there is only one option  you need to make your plugin or workflow asynchronous.

    Hope this helps.

  • Pranesh M Juwale Profile Picture
    1,196 on at

    Hi Goutam,

    The issue here is due to data processing is taking longer time.

    I Have tried sync, async plugins, custom workflows & all responds with timeout exception of 2mins.

    I think Michel has answered the correct way.

    Let me check with the same.

    Regards,

    Pranesh

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Pranesh,

    You are correct, regardless of plugin is working as sync or asyn, it is is registered in isolation (which is by default for crm online) it will timeout after 2 minutes. It is mentioned in the MSDN as well

    msdn.microsoft.com/.../gg327941(v=crm.7).aspx

    However I ran into the similar issue where my custom workflow was throwing 2 minute timeout but the workflow was just creating 16-17 records. I investigated and found that during the creation fo record, there was some other plugin getting executed which created a sql deadlock lock resulting in a 2 minute timeout. After disabling the other plugin, my custom workflow worked fine.

    Sharing this just in case you have some similar thing going on :)

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