In JS Scripting:
if(now.isAfter(time.toZDT('07:00') && now.isBefore('17:00')) {
...
}
else {
...
}
compared to
if(event.triggerId == 1) {
...
}
else if(event.triggerId == 2) {
...
}
Exact same number of lines of code.
You don’t need to reproduce the exact trigger conditions. This rule gets triggered exactly twice a day. If it triggers and it’s between 07:00 and 17:00 you know that it was the first trigger. Otherwise you know it was the second trigger. There could be hours between the cron time and the rule running and it will still do the right thing. If you want it to be really tight
if(now.isClose(time.toZDT('07:00'), time.Duration.ofSconds(1))) {
...
}
else if(now.isClose(time.toZDT('17:00'), time.Duration.ofSeconds(1))) {
...
}
You could go down to the nanoseconds if you wanted to and make it as tight as you want, but there is no need to.
I’m not arguing against adding this information to the event
(it’s never going to be available in UI only rules, only Script Actions), but the lack of it really isn’t that big of a deal.