Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

Posted on by

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

  • Verified answer
    cranialsurge Profile Picture
    cranialsurge on at
    RE: Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

    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

  • cranialsurge Profile Picture
    cranialsurge on at
    RE: Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

    This is an existing plugin that needs to be sync and run pre-op.

  • Bruno Lucas Profile Picture
    Bruno Lucas 5,421 on at
    RE: Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

    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

  • cranialsurge Profile Picture
    cranialsurge on at
    RE: Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

    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.

  • Suggested answer
    Bruno Lucas Profile Picture
    Bruno Lucas 5,421 on at
    RE: Can an action invoke an asynchronous child workflow and pass its parameters to this child workflow.

    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:

    Convert an asynchronous workflow to real-time and back

    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.

    msdn.microsoft.com/.../dn481598.aspx

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans