Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set an inbound working on weekdays.

Shinu_snow
Tera Contributor

Hello,

 

I have a scenario to create an inbound action with the following conditions:

  • When the instance receives an email containing "(CRITICAL)" in the email subject, and

  • "Integrated Management Log Severity: CRITICAL" in the email body,

  • Then an incident record should be created.

The tricky part is:

  • This should only happen on workdays (Monday to Friday).

  • Emails received on weekends (Saturday or Sunday) must be ignored, and no incident record should be created.

The condition and script I provided are shown below. The inbound action is working, and incidents are being created, but they are also being created on weekends. I need to prevent incidents from being created on weekends.

Shinu_snow_0-1755019310568.pngShinu_snow_1-1755019385763.png

Thanks in advance!!

5 REPLIES 5

Bhuvan
Giga Patron

@Shinu_snow 

 

Check the value it returns for the GlideDateTime as system takes Sunday as 7 and Monday as 1. 

 

https://developer.servicenow.com/dev.do#!/reference/api/yokohama/server_legacy/c_GlideDateTimeAPI#r_...

 

Bhuvan_0-1755444553185.png

Bhuvan_1-1755444569741.png

Tweak the code accordingly and test, it should work fine.

 

If this helped to answer your query, please accept the solution and close the thread.

 

Thanks,

Bhuvan