I have an action that is invoked by a sync. plugin which passes some arguments to it. I want this action to perform some work asynchronously. Currently I have the action calling a custom workflow activity, but the flow is synchronous. Would it be possible to have this action call an asynchronous child workflow instead and pass its argument values to this workflow?
Are there any other alternatives to allow a synchronous plugin to perform some work asynchronously (essentially a fire and forget scenario) via an action?
*This post is locked for comments
Figured it out! This post explains exactly what I was looking for along with a solution: crmtidbits.blogspot.pt/2014/02/bypass-plug-in-transaction-to-log.html
This is an existing plugin that needs to be sync and run pre-op.
Did you try to register the plugin as async? do you have functionality on that that need to run on pre-op? if not you can register to run async post-op
Thanks for your response! Currently I'm not using a workflow. I have a custom workflow activity assembly instead that gets called by the action when that action is invoked by a synchronous plugin. However the problem with a sync plugin is that if an exception is thrown in it and it is registered as a pre-op or a post-op plugin it results in the main operation getting rolled back because all of them are part of the same DB transaction.
My objective is to be able to still create a log entity record in CRM even if a plugin exception occurs which would cause whatever work it was trying to achieve to be rolled back. I was hoping to be able to achieve this asynchronously so that the rollback of the DB transaction does not impact the creation of an error entity record.
Are you trying to use C# async call on the Action or do you want to change the workflow to run Async? Sync workflows were introduced in 2013, normally they are already async.
you can change by just ticking\unticking this option:
blog.clickdimensions.com/.../using-real-time-synchronous-workflows-in-dynamics-crm-2013.html
you can do it programmatically:
You can convert workflows from asynchronous to real-time and back using UpdateRequest without the need to rewrite the workflow, as long as the asynchronous workflow doesn’t contain any wait or delay activities. You can also do the conversion interactively by using the web application. The workflow must be in a draft state (not-activated) before the conversion is performed.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,232 Super User 2024 Season 2
Martin Dráb 230,064 Most Valuable Professional
nmaenpaa 101,156