Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Conditional Email Send

danloz
8 - Asteroid

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:  

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Sending-emails-based-on-conditions/td-...

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?  

danloz_0-1635527432793.png

 

danloz_1-1635527467122.png

danloz_2-1635527540340.png

 

 

 

 

4 REPLIES 4
BrandonB
Alteryx
Alteryx

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. 

danloz
8 - Asteroid

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?  

danloz_0-1635528584377.png

 

 

 

Also slight update.  When I run it in designer, I notice this:  

danloz_1-1635528655610.png

 

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.  

 

 

BrandonB
Alteryx
Alteryx

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.

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels