I need to create a trigger that occurs every month. I can’t find the function. Can anyone help me??
Original (Italian): Ho necessità di creare un trigger che si verifichi ogni mese. Non trovo la funzione. Qualcuno mi può aiutare??
I need to create a trigger that occurs every month. I can’t find the function. Can anyone help me??
Original (Italian): Ho necessità di creare un trigger che si verifichi ogni mese. Non trovo la funzione. Qualcuno mi può aiutare??
Hi Marco-
Welcome to the community and thanks for posting! We don’t have a ‘monthly’ trigger, but community members have come up with creative ways to accomplish this.
For example, I’ve seen some community members create a daily rule that uses an expression to set a variable indicating the Day of Month (1-31
). Then they can use that $dayOfMonth
variable as a Trigger for other rules and only trigger when it’s their desired day of the month (eg. 1
).
For example, here’s a basic rule demonstrating the concept:
As for the expression, it’s using the formatDate()
method which is documented under the Date Formatting section of the Date Functions Help Article.
formatDate(now(), 'D')
We’re basically just asking it to format the current date/time using only the ‘day of month’ → 'D'
. You can reference the Date Formats Help Article for the full list of available formatting tokens.
Once you have the day of month stored as a numeric variable, you can use it however you like. In my example, the rule is triggering every day and updating the $dayOfMonth
variable with the numeric day of month 1-31.
Then the rule uses an IF Condition so it only executes the special ‘first day of month’ actions if the $dayOfMonth
is 1.
In my example above, I’m doing it all in a single rule to make the demonstration simple, but most people would have a separate rule just for setting the variable… then you could use that variable value changing as a trigger in other rules: