Correct should be sending notifications 30 days before, 60 days before and 15 days before. Any example to mount everything in workflow should I use filter or branches? So workflow know when we have documents that expires 60 30 15 days.
The sql query is clear but to mount that on workflow is what I don't understand
It looks like you already have it set up to run daily and have attached the Postgres query in the right place from your second screenshot. For the SMTP query have you explored using a loop block and attaching that to the Postgres query?
1 Like
But then, I just need one query? I had 3 , ok so one query but then how workflow knows when the query got results and send diff email if 30d subject of email should be diff, same with 60 and 15d
Oh! I missed that part sorry. The case statement is super helpful for that! You might also be able to add a separate column just like @ScottR did that tracks that time to expiration:
select
*,
extract(
days
from
(seguro_expiraction - current_date)
) as time_to_expiration
from
vehiculos
where
seguro_expiraction = (current_date + interval '60 days')
or seguro_expiraction = (current_date + interval '30 days')
or seguro_expiraction = (current_date + interval '15 days')
How different would the message be in each case? If it's small enough I imagine you can use {{}}
and the time_to_expiration
property to customize it. Otherwise, you might be able to conditionally trigger different function blocks from your loop!