Check if current date is today in workflow?

hi im building a workflow to send a notification when a new record is saved in a db mysql right now i got this query

what i can send a email when a new record is saved? im thinking in use the transaction_Date but how i know thats the newest record to send auto emails?

or theres any other way to check when a new record is saved in my db?

thank you

Hey agaitan!

Perhaps you can add a boolean column to your table to store if you have notified for that specific transaction (or timestamp of last notification and type of the notification, perhaps JSONB object if you really need details).

Following that you can only filter records that have not been notified so you are only sending email for completely new record.

Approach might change depending on your use case but hope this help steer you in the right direction!

1 Like

But if I already got timestamp date etc I can't use that column only? Or need boolean, which will be your approach

Timestamp date of notification, because if you never send a notification that timestamp should be empty so you know you haven't notified for that record - it enables you to easily filter newly created records.

I used to have a boolean for the notification, though at some point I've got a multiple set of different notifications so I had to start tracking it differently (with an object).

So if your use case is simple and you do not foresee complexity in near future any of the 2 simple approaches will work for now :slight_smile:

1 Like

Interesting, so I should record that timestamp in the workflow right is the possible to insert a record on workflow?? But what happen if in the query I got 5 records, will the workflow send 5 diff emails notificating those records?

You can push back the date of notification to the original records within the database (1 or multiple using bulk upsert).

i.e. If you query and get 5 new records you can send 1 notification containing those records while pushing the same notification date to each individual notification.

Awesome that works

Thank you