Flow Designer: how to send just one email based on a number of records

fbs
Giga Expert

I am very new to all of this. I want to use a flow to send email that has information from a number of database records. Currently I have a Look Up Records action and then a For Each action that sends an email based on some data in each record. So, this might send 10 emails. I don't really want to send the email until I have read a number of records (based on a condition -- maybe a value of 0 in a given field. So, what should I do in my For Each action instead of sending mail? Do I have some kind of a script that writes to a variable and then use the variable when I want to send mail? What is the best way to accomplish this? Thanks

1 ACCEPTED SOLUTION

fbs
Giga Expert

OK - I have figured this out.  The correct line for the script is:

return fd_data.flow_var.issuetext += fd_data._2__for_each.item.issue + ';'

Thanks

View solution in original post

12 REPLIES 12

fbs
Giga Expert

The first issue is solved; looking at logs show it actually works.  But for the second issue, I can't get the scripting right. I have 2 Flow Variables: issueType and issueText.  In the Set Flow Variables step (under For Each, so it happens 5 times), I set both variables each time. 

For issueType, I do:

return fd_data.flow_var.issueType += fd_data.flow_var.issueType
 
For issueText, I do: 
return fd_data.flow_var.issueText += fd_data.flow_var.issueText
 
At the end, when I send email, I use Flow Variables->issueType and Flow Variables->IssueText in the body (gotten from the pill), but the email only has the issue type and text from the last record.  What am I doing wrong?

 

fbs
Giga Expert

OK - I have figured this out.  The correct line for the script is:

return fd_data.flow_var.issuetext += fd_data._2__for_each.item.issue + ';'

Thanks

ra3
Tera Contributor

what was your solution for??

 Issue 1: It doesn't seem like the For Each is iterating through all 6 records, though it indicates that it does.  From the execution, it looks like it's only doing one record, and it only looks like it's logging one record.  And it doesn't seem like the same record.  In the run, it says Set Flow Variables 1 and Log 1.  I thought it would do it 6 times