Automate WebReports Using Custom Relevance

I am trying to automate some email alerts from WebReports. I can’t use the Send an Email Notification fixlet, because the SMTP config fixlet does not let me choose SSL, which is a requirement for our Mimecast SMTP Relay. I can use WebReports, but there is no option to send reports on the X Day of the month (e.g. 2nd Tuesday, 3rd Friday, 4th Monday, etc.) without using Relevance. See attached screenshot of the WebReports scheduler options.
WebReportsScheduler

Weylan from BigFix Support helped me find the following Relevance, which evaluates to the correct day of the week (with some tweaks). The problem is I need it to evaluate to True or False to use it in WebReports (I tested today and never got an email), and I can’t seem to figure that out. I have also confirmed that setting this relevance to True does work and I get the email from WebReports, so it is not an SMTP config issue.

Evaluates to Second Tuesday:
Q: (if (it > current date) then (it) else ( (it + 7day) of first tuesday of month_and_year of (current date + 1 * month) ) ) of ( (it + 7day) of first tuesday of month_and_year of current date )
A: Tue, 12 Sep 2023

Evaluates to Third Friday:
Q: (if (it > current date) then (it) else ( (it + 14day) of first friday of month_and_year of (current date + 1 * month) ) ) of ( (it + 14day) of first friday of month_and_year of current date )
A: Fri, 18 Aug 2023

What I need is for the Relevance to evaluate to True or False, not the actual day of the week, so the reports only send when it IS the Second Tuesday or Third Friday. I was thinking something like this might work:

Q: if (current date = (if (it > current date) then (it) else ( (it + 7day) of first tuesday of month_and_year of (current date + 1 * month) ) ) of ( (it + 7day) of first tuesday of month_and_year of current date )) else false
A: True or False

But this Relevance does not work. No matter where I put the ( ), I always get “E: This expression could not be parsed”. I’m not sure if there is something wrong with my syntax or if what I’m trying to do is just not possible. Please let me know if this is possible or if I need to determine another method. Any assistance or ideas you can provide would be greatly appreciated!

Many thanks!
_Matt

Hi @casmxg, is this what you need?

Q: now as local date
A: Fri, 03 Nov 2023
T: 0.308 ms
I: singular date

Q: (if (it > current date) then (it) else ( (it + 14 * day) of first friday of month_and_year of (current date + 1 * month) ) ) of ( (it + 14 * day) of first friday of month_and_year of current date )
A: Fri, 17 Nov 2023
T: 0.275 ms
I: singular date

Q: now as local date = (if (it > current date) then (it) else ( (it + 14 * day) of first friday of month_and_year of (current date + 1 * month) ) ) of ( (it + 14 * day) of first friday of month_and_year of current date )
A: False
T: 0.218 ms
I: singular boolean

Q: (if (it > current date) then (it) else ( (it + 7 * day) of first tuesday of month_and_year of (current date + 1 * month) ) ) of ( (it + 7 * day) of first tuesday of month_and_year of current date )
A: Tue, 14 Nov 2023
T: 0.146 ms
I: singular date

Q: now as local date = (if (it > current date) then (it) else ( (it + 7 * day) of first tuesday of month_and_year of (current date + 1 * month) ) ) of ( (it + 7 * day) of first tuesday of month_and_year of current date )
A: False
T: 0.087 ms
I: singular boolean
1 Like

Thank you! I did a little testing of this in QNA and it should do the trick. I’ll mark your post as the answer after I do a true test. Many thanks for the quick and helpful response!

_Matt

I’ve used something like this:

(first tuesday of current month_and_year + (14 * day) = now as local date) AND (item 0 of it AND item 1 of it) of (hour_of_day of it = 13, minute_of_hour of it = 0) of time of current time_of_day

And also made sure to uncheck only when report has changed

Of course you can change it to time range etc…

1 Like

The solution from @gus was very nearly correct. I had to make one change to the first IF of the relevance, changing the > to a =, so that when it IS the 2nd Tuesday, or 3rd Wednesday, etc, it will evaluate to True.

For example, the following will evaluate to True if it is the 2nd Friday:
now as local date = (if (it = current date) then (it) else ( (it + 7 * day) of first friday of month_and_year of (current date + 1 * month) ) ) of ( (it + 7 * day) of first friday of month_and_year of current date )

Thanks!
_Matt