Dear Tapan,
You can create a workaround with the built-in date&time functions.
I show you an example i have just created:
- 1st step: Create a „Set variable” and connect it to the second module of your choice. This set variable will give you the date of the actual month's first Tuesday dynamically. (Note: You do not need the filter you can see between the modules yet. The Celonis Query data module is just an example to be able to set the filter)
- 2nd step: Set the variable formula: {{formatDate(addDays(setDate(now; 1); 1 * 7 - formatDate(addDays(setDate(now; 1); -2); "E")); "YYYY.MM.DD")}}
- At first it is a bit complicated, it does the following:
- it returns the current month's first day's weekday in number (Its 7, as 2023.10.01. was Sunday)
- We have 7 days in a week. As the code checks which was the first weekday number (7), it substracts the desired day's (Tuesday's) weekday number (7-2 = 5). Then it all get substracted from the n*available weekday number (1*7-5 = 2), where n is the nth occurrence of the weekday (its 1 as we want the first Tuesday). After that, the code adds this result (2) to the first day of the month (10.01. + 2 = 10.03.). This logic is working in other scenarios as well, let's say the date is 2023.12.01. (It's Friday, weekday num is 5. We substract 2 from it (as we still want Tuesdays), result is 3. Substract the result (3) from the available weekday numbers (7), result is 4. Add it to 12.01. result is 12.05. which is the first of December's Tuesdays.
- It formats the result to YYYY.MM.DD so it's easily comparable later.
- 3rd step: Set the filter so that the date when the execution happens equals to the variable's date. {{formatDate(now; "YYYY.MM.DD")}}
- 4th step: Save and Publish
- 5th step: In view mode, click the variable module's scheduling mode. Set the scheduling to "Every Day" or if you want to save execution runs, then set "Days of the week"-"Every Tuesday"), and pick the time. Note that the time zone is London, so you might have to adjust it accordingly. This way, when the action flow executes at a given time you set at scheduling, it checks that whether the actual date you set at the filter is equal to the set variable date, which is the first Tuesday of the month.
Pay attention for the time zone, because it will execute based on London Time.
To test it - as it is the first Tuesday today - set the Time in the schedule 1 min ahead of current London time and do not forget that your action flow needs to be saved and published, then activated in view mode to actually run.
If you change the formula to {{formatDate(addDays(setDate(now; 1); 1 * 7 - formatDate(addDays(setDate(now; 1); -3); "E")); "YYYY.MM.DD")}} , change the schedule to current+1min again, then you can see that the set variable module finishes, but not the Query, since in the code, we changed the desired date to first Wednesday. Do not forget to change the code back if you need it.
Hope it helps.
Yours,
Zsolt Borbely
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.