Skip to main content
Solved

Send email only if records found on a "repeat for each" action loop

  • October 3, 2024
  • 3 replies
  • 57 views

Forum|alt.badge.img+6

Hello,

I am building a project management tool and want to send daily messages to the users on late tasks, upcoming etc...

to do so, I have created my automation as follow:

 

The idea is to run automation everyday, look for all users from a table 'participants', and for each one of them search for late tasks assigned to them. Generate an email and send it to each recipient. (I don't want to generate 1 email per late task.... too many messages)

This works great as is, except that if there is nothing late in the queue for a user, he will still get an email with an empty table...

anybody has a solution to add a condition on this automation?

thanks!

Best answer by FarioConsulting

Hi Allan,

You could add a script action after the "Find records" step to check if any records were found. If no records are found, you can then stop the automation and prevent an empty email from being sent.

3 replies

Forum|alt.badge.img+6
  • Author
  • New Participant
  • 4 replies
  • October 3, 2024

well... sometimes writing down gives ideas....

so that everyone gets at least ONE solution for this kind of issue...

 

I have added a lookup field on my tasks with limitations as follow:

-is late (due date past current date)

-is not done (status <> done)

 

2/ I created a filtered view that only displays items where this lookup is not empty

 

I limit my first action (list all users) to this new filtered view.


Forum|alt.badge.img+6
  • Participating Frequently
  • 15 replies
  • Answer
  • October 4, 2024

Hi Allan,

You could add a script action after the "Find records" step to check if any records were found. If no records are found, you can then stop the automation and prevent an empty email from being sent.


Forum|alt.badge.img+6
  • Author
  • New Participant
  • 4 replies
  • October 7, 2024

Thanks FarioConsulting.

I will mark your message as the "clean" solution, even if mine worked as well.

I consider adding as little as possible columns for technical use, if doable by script, is better -> you win 🙂