Hi Gang,
Here's my situation:
I've got a weird condition that keeps popping up in a database. I'd like to scan for it every few minutes and tickle somebody to fix it. Therefore, my workflow should:
1) Run a query against the db for a specific set of criteria
2) Evaluate whether a condition is true (ie, do records exist that meet this criteria)
3) If 2 = true, send an email to my target user
I'm trying to implement this method:
Strange, 1 and 2 seem to work fine. 3 seems to be posting the problem, as the email seems to send regardless of the error being tripped from the message tool.
Here's what I believe to be the relevant portion of the workflow:
Based on my read, stream out results in 0 records, block until should first route the 'empty' data to be counted, where the count happens, when the count comes out to 0, we'll get the error condition and the message sent to the console. This all happens. I think based on the run time setting the workflow should terminate at this point, but weirdly it seems to continue on and send a mostly empty email anyhow.
So if I had to hazard a guess, something about that runtime setting "cancel on error" is not working as expected. Can anybody offer any insight?
Solved! Go to Solution.
What if you use the email tool as an alternative? If no records are passed in to the email tool it will not send an email because it sends one email for every record that makes it to the tool. That way you could have maybe a record count appended followed by a filter where record count != 0 so that way no email will send if the record count is zero.
Interesting.
I implemented the email like this, so there's always going to be a record getting passed in. How would it look if I were to do it as suggested?
Also slight update. When I run it in designer, I notice this:
Based on the second message for EMAIL(14), the error is being caught but only after the email tool is executing. It's weird that would happen considering I have block until done on the error, so maybe I'm misusing the run time setting.
Block until done won't stop something else from completely executing, it just processes what comes out of the 1st anchor before the 2nd and then the third. My point was that if you did a record count on wherever you need to check, then append this value using an append tool to after your layout is connected. Then follow this with a filter tool that says count != 0. This means that if the count is zero the record would go to the false, nothing would be coming out of the true and therefore the email would not send. If it was non zero it would pass through and therefore send an email.
Your other issue is that your email tool isn't successfully connecting to your SMTP server.
Thanks for the suggestion! It worked like a charm for me.