Skip to content
+1-888-319-3663

COMMUNITY FORUM

Conditional Success Email

Paul Livengood asked 6 years ago
It would be nice to have the ability to only send email on success only if records are processed (or if other conditions are met).  We have the map setup to return success if no records are returned so that the event log does not fill up, but now an email goes out each time the map is run. 
Answers
Patrick Roth Staff answered 6 years ago
Paul,
You can make your map do something like this.
make an ‘after document success’ script.
in it, set a global variable to a value, for example
GBL_MAPDATA=”TRUE”
now if the ‘after document success’ script runs, then you know you had data that was success.
we could put it on ‘after document failed’ but we don’t need that as I assume your fail condition already works.
Now in your ‘after map success’ tasks
make a new task called “CHECK_HAS_DATA” or whatever.
in it, we just need to our variable
if GBL_MAPDATA = “TRUE” then
   return true
else
   return false
end if
set the “on success” to “Go To Next Step” because if there was data we want to send the email (task #2 in the list)
set the “on fail” to “cancel processing”.  this should stop the map tasks from running (without any errors thrown) and so then the “send email” task doesn’t run.  which is what you want.
patrick

If you would like to submit an answer or comment, please sign in to the eOne portal.