Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Real-time vs background workflows and the database transaction

Posted on by 2

Hi all

I have a situation where I run a Real-time WorkFlow in response to the create/update of a record. Under certain circumstances, I'd like to send an email to an administrator alerting them of the situation, and then cancel the WF so that this current instance of it stays in the Process Session history for me to evaluate (I dump some tracing info into the Stop Workflow -> Cancel step).

The problem I'm having is that if I cancel the WF, the email doesn't send (I'm assuming because the create/update is rolled back as part of the transaction). So the obvious solution was to put the sending of the email into a child WF and trigger it from the current WF. 

But that DIDN'T solve it. The parent WF is best suited to run Real-time, and the child WF, regardless of whether the child WF is set to RT or Background, seems to be executing within the DB transaction of the parent WF, and the email is not created! Surely if the child is Async, it shouldn't matter if the parent is RT or Async? If the child WF is Async it should run in its own transaction and the email should be created?

I then also played with switching the parent WF to Async (which is not ideal, but I wanted to see the outcome), and found it just as confusing - this time the email created, regardless of whether the child was RT or Async!

This makes no sense to me? Can anyone explain the results below?

Parent Child  Outcome
Async  Async Email
Async  Real-time Email
Real-time Real-time No email
Real-time Async No email

Which brings me to my issue - how do I send an email from a RT WF that I want to Cancel...?

Thanks!
James

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,207 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans