Need Help on Business Rule creation- check the details below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
We need to create a Business Rule on the Email [sys_email] table in ServiceNow.
At the time of record insertion, the rule should check whether the email is created between 9:00 AM and 6:00 PM IST.
If the condition is met, the Type field should be updated to Send Ignored.
After i need Scheduled job should run after 6pm ist and updated the above emails to send Ready state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Swathi KS ,
it looks that you have gathered all the requirements, where's the problem? What did you do and where did you get stuck?
100 % GlideFather experience and 0 % generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @Swathi KS ,
According to you requirements the BR should be :
var now = new GlideDateTime();
now.addSeconds(19800); // IST offset = +5:30 = 19800 seconds (In case your TZ is different)
var hour = parseInt(now.getHourOfDay(), 10);
if (hour >= 9 && hour < 18) {
current.type = 'send-ignored';
}
and for Scheduled Job :
var gr = new GlideRecord('sys_email');
gr.addQuery('type', 'send-ignored');
gr.query();
while (gr.next()) {
gr.type = 'send-ready';
gr.update();
}//Note run Daily at 6 PM
If my response helped mark as helpful and accept the solution.
