Hi - I'm trying to send alert emails from my workflow only when certain conditions are met. The conditions are simple: there needs to be at least one record in that lane of data. Please see my workflow below. Basically, after each of the two Unique tools, I only want to construct and send the downstream emails if the count of records coming out of each of those Uniques is 1 or greater. Any thoughts? I've tried summing by grouping on all fields, then doing a count distinct, then applying a filter before the container that is CountDistinct_Field >= 1. When I attached that to the Basic Table part of my email, it worked, but the photo and the Intro text both still showed and the email was sent. Any insights appreciated. Thanks!
Two lanes of my workflow. I want the emails within the containers to only be sent if the lane contains 1 or more records.
Solved! Go to Solution.
Hi,
Can you append the Count variable to the data stream after the second Append Fields and then filter on it before the email tool?
Cheers,
Iain
@BradFolger How about using a Count Records then Test tool after your Unique tool?
With this setting, your workflow will error (and therefore stop) on this condition. I use this without a Block Until Done tool and don't have any issues but you might need one to make sure the test happens before the email is generated.
@bradfolger
I believe you can insert the filter immediately before your email tool. Assuming you have the countdistinct_field as an available field in your datastream, that would prevent the email from going out.
If not, you may need to join the countdistinct_field back to your data after the vertical layout.
I use a similar approach to only send email records on certain days of the week.
@ddiesel Thank you very much for your guidance -- unfortunately, I don't want the workflow to fail on this condition, as this is only a warning as opposed to a show stopper.
@BradFolger If the filter is immediately before the email tool, the workflow will not fail based on this condition. The email tool will just not send any records as there is no incoming data.
I've attached a very simple workflow as an example. This will not error, but will send no email based on the filter.
@neilgallen Thanks, Neil. My previous response was related to the other offered solution -- I am going to try this out today and will let you know - thanks again!
@ivoller, thanks for your initial guidance. Below is what I wound up doing, for anyone with the same question. Basically, I added a count distinct of the rows, then appended it back to the result set, then used a formula just before the email tool to check for "count >= 1". Works well, thank you everyone for your input.
Thanks for @BradFolger sharing the solution! This one is going in my back pocket.