Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Conditional email

abhinabaroy09
7 - Meteor

Hello,

 

In my workflow I have a filter on the date, i.e., if the date in the 'Date' field matches with the criterion then we send out an email with the relevant data OR if there are no data points matching the criterion then the email body should read "No relevant data found".

 

Please note that I would like to send out only a single email.

 

How can this be done in Alteryx?

 

Thanks,

Abhinaba

8 REPLIES 8
suli
9 - Comet

Just use a normal filter with 2 outputs.

 

Sample workflow attached. Is it what you were looking for?

abhinabaroy09
7 - Meteor

Suli,

 

The workflow you proposed will trigger two emails. I only want one email to be sent out based on the record counts, i.e., if there are records send EMAIL1 with the data rows else send EMAIL2 with the message "No relevant data"

suli
9 - Comet

You are right.

 

How about the one below?

 

Making use of Union and select Record.

suli
9 - Comet

Noticed a small issue in the workflow above.

 

The one below is more flexible.

abhinabaroy09
7 - Meteor

This is great..thanks a ton :)

 

I have a doubt which is kind of an extension to the above problem.

 

If I have to create an excel file with the TRUE set rows and then attach it to the email keeping in mind that the email should be triggered only after the excel creation is successful (i see a BLOCK UNTIL DONE tool, but not having it work as intended), what should be the change(s) made to the workflow?

 

Thanks again

suli
9 - Comet

You can also try to go to events tab (Workflow Configuration) and send email with attachment after successful run (with no errors).

 

Once there are no records to create your excel, you can use 'Test' tool to generate an 'Error'. Then add event - email after run with errors - and add desired text.

 

Those events are conditional and mutually exclusive.

 

Hope that helps!

abhinabaroy09
7 - Meteor

Could you please share a workflow with the two cases you mentioned? I am new into using Alteryx, apologies for not understanding

suli
9 - Comet

Hi,

 

Please find attached sample solution. There are 2 ways you can generate errors: with 'Test' tool or with 'Message' tool.

Solution steps are as follows:

1. Workflow Configuration

a. Runtime - Cancel Running workflow on error

b. Events - add 2 events

-email after succesful run (with attachment - Output File)

-email after run with errors (no attachment)

2. Use 'block until done' in order to ensure that first part of the flow (with test) will be run before attempt to save the file

a. if there is an error on expected record count, workflow will be cancelled (no attempt to write output file), and email with no attachment will be sent

b. If there is no error on record count, entire workflow will be executed and email with attachment will be sent.

 

Please let me know if you have any questions!

ps. once you set up your email make sure 'from' and 'to' fields are not the same :)

workflow.JPG

Labels