Tips & Tricks for Dynamics 365 CRM Asynchronous Service

Dynamics 365 CRM Asynchronous service is responsible for the execution of all workflow, plugins and jobs that are configured to run in the back-ground.

The asynchronous service executes long-running operations independent of the main Dynamics 365 CRM core operation. It is recommended to utilize this async mode for any long-running operations and avoid running it in sync mode which runs on the front-end servers and will cause end-user to wait for a long time until the operation is completed.

This results in improved overall system performance and improved scalability. The asynchronous service features a managed queue for the execution of asynchronous registered plug-ins, workflows, and operations such as bulk mail, bulk import, and campaign activity propagation. These operations are registered with the asynchronous service and executed periodically when the service processes its queue.

Below are some tips & tricks to ensure this service is running properly without performance issues:

  • Don’t trigger workflows based on change in the field modified on, it will cause infinite loops, this is applied for both real time and background workflows.
  • When having many sessions for a background workflow that are waiting for resources and you changed it to real time workflow, restart the asynchronous service such that the old sessions are deleted from the AsyncOperationBase table and avoid blocking other background processes.
  • In case you have to cancel a large number of workflows, you need to cancel them first using a custom tool, then bulk delete them.
  • Don’t create a record in one parent workflow that fires another OnCreate workflow which deletes the same record created in the parent workflow as it will result in a platform exception due to the dependency of the parent workflow on the created record.
  • You can find here the AsyncOperationBase table operation types, state codes, and status codes which are very important to maintain the workflows running in the background: AsynOperationBase Entity
  • We need to regularly maintain the AsyncOperationBase clean-up as per the below support article to ensure best possible performance: Performance is slow if the AsyncOperationBase table becomes too large