Condition in Scheduler to send and email. | Community
Skip to main content
Level 2
August 19, 2022
Solved

Condition in Scheduler to send and email.

  • August 19, 2022
  • 2 replies
  • 1081 views

Good afternoon,

 

Can you help me with this need: I have to schedule a flow to run, for example, 5 days after the first delivery that is in an initial workflow has been sent. My idea is to put a scheduler that runs every day and then a condition to validate the eventdate of the first workflow if it occurred 5 days ago in order to send the second workflow.

 

Cheers

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Yamila1981

Hello!!!

I found a way to get back to the contacts that were sent an email a few days ago. For example, contact those who received an email 5 days ago. So I start from the DeliveryLogs table and the EventDate field. What I do is the following: ToDate(EventDate) = ToDate(AddDays(GetDate, -5))
It is a little longer but it helped me to learn a little more. I also appreciate your suggestion that I will put into practice.

Cheers

2 replies

Marcel_Szimonisz
Community Advisor
Community Advisor
August 21, 2022

Hello @yamila1981 ,

you are not far from the result. Event date on workflow does not exists (last run or last modified but it may result in wrong results ) Query all deliveries instead, with contact day that is 5 days ago, with  the use of dateOnly() on both contact date and 4 days ago expressions and run it daily

 

Marcel

Yamila1981AuthorAccepted solution
Level 2
August 24, 2022

Hello!!!

I found a way to get back to the contacts that were sent an email a few days ago. For example, contact those who received an email 5 days ago. So I start from the DeliveryLogs table and the EventDate field. What I do is the following: ToDate(EventDate) = ToDate(AddDays(GetDate, -5))
It is a little longer but it helped me to learn a little more. I also appreciate your suggestion that I will put into practice.

Cheers

Shubham_Goyal__
Level 6
August 23, 2022

Hi @yamila1981 ,

You can make a query activity on xtk:workflow table which fetches workflows on basis of their last execution using date-time function "DaysAgo(5)". Now the DaysAgo() function returns the date and current time so you can wrap this function under DateOnly so the start time is 00:00.
Here is an query condition example you may use on your side to achieve this where this query will return all workflows that were processed on or after 00:00 5 days ago to 23:59. 🙂 

 

 
Cheers,

Shubham

Level 2
August 24, 2022

Hello _Shubham_Goyal_!!!

I found a way to get back to the contacts that were sent an email a few days ago. For example, contact those who received an email 5 days ago. So I start from the DeliveryLogs table and the EventDate field. What I do is the following: ToDate(EventDate) = ToDate(AddDays(GetDate, -5))
It is a little longer but it helped me to learn a little more. I also appreciate your suggestion that I will put into practice.

Cheers