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)
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

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