I have a table which has pet data, one of the field is ‘date_of_birth’. I need to send birthday wishes for these pets. I am thinking of doing it this way. Can you let me know if there is a better way in terms of WUs.
I search for pets whose day is curdate:extract date and month is curdate:extract month and last wished is not curdate:extract year
send a mail
update last wished to curdate:extract year
Schedule this workflow if there exist any pets whose day is curdate:extract date and month is curdate:extract month and last wished is not curdate:extract year
You are performing one search per pet. That’s underperfoming.
Just do SAWOL (Schedule an API workflow on a list) on API workflow birthdayreminders with the list of Pets fulfilling
date = Current date/time:extract date
month = Current date/time:extract month
There’s no need for field Pets' LastWished.
This way your are saving yourself of doing N searches when you have N Pets to act on a certain date + modifying Pets records to update the LastWished field.
Total WU saves are
0.3 * (N-1) → Performing one search vs N Not sure if server performs the search just once, as constraints are the same, just like client-side does. It think it does not.
0.5 * N → Modifying N Pets records for updating field LastWished
SAWOL will be fine here up to 100k records per search (doubt you’ll exceed 100k dogs with the same month & date anytime soon)
you’d want to send it using postmark or similar api email provider also so the email sends are managed and spaced out a bit slower than SAWOL might run. and also so you get email log reports and can track opens and manage unsubscribes etc
you may also want to add rules so that emails only send within certain hours or to certain segments (ie users subscribed to marketing)