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 | |
Async | Real-time | |
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