Workflow automation - year interval

When will be the “yearly” interval in workflow automation triggers available?

I have date of birth as value in our employees table, and I would like to receive email notification 1 day before that day.
Is there any easy way on how to do it without “yearly” interval?

(Right now i have metadata table which is filled everyday by custom script with information if this day somebodies birth date is modulo 1 year… and then if there is new record in metadata table, i am sending birthday notification… but it is really not nice solution)

Hello Tomas,

we are planning this extension in the near future, but for now this requirement can only be solved using JS and workflow.

First you need to add the next birthday date field to the table. These are calculated using JS. See image below:

Go to the Scripting area and write this JS code:
On model load:

 doo.model.nextBirthday.isEnabled = false;

On model change:

    if (doo.model.birthday.currentlyChanged) {
        if (doo.model.birthday.value) {
            const now = new Date();
            const birthday = new Date(doo.model.birthday.value);
            let nextBirthday = new Date(new Date(birthday).setUTCFullYear(now.getUTCFullYear()));
            doo.model.nextBirthday.value = <any>(nextBirthday < now ? new Date(nextBirthday.setUTCFullYear(now.getUTCFullYear() + 1)) : nextBirthday);
        }
        else
            doo.model.nextBirthday.value = null;
    }



Then you must create two workflows:

  1. Recalculate next birthday → Trigger: When it’s time → Select the table → Select the field: Next birthday → Action : Run script
    JS:
    if (doo.model.nextBirthday.value) {
        let nextBirthday = new Date(doo.model.nextBirthday.value);
        nextBirthday = new Date(nextBirthday.setUTCFullYear(nextBirthday.getUTCFullYear() + 1));
        const fields = { nextBirthday: nextBirthday };
        await doo.table.updateFields('porovnani', doo.model.id, fields);
    }



  1. Birthday reminder → Trigger: When it’s time → Select the table → Select the days and field: Next birthday → Action: Send Email → Body:
Birthday: ${new Date(doo.model["nextBirthday"].value).toLocaleDateString()}

And it’s done!

Thank you

With kind regards,
Soňa

1 Like