How to stop running business rule on specific period of time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2024 03:39 PM
Hi Team,
we have two business(insert, update operation) , which plays major role in daily activity.
This two Business rules should work only between morning 6AM-afternoon 3PM. after 3PM/before 6AM if any insertion/updating happens on record these BR's should not respond..
Every day we can't deactivate/Activate , so How can we achieve it ? any possibility ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 06:04 PM
I'm trying in Scoped Application
var schedule = new GlideSchedule("090eecae0a0a0b260077e1dfa71da828"); 8-5 working days sys-id I took
if (schedule.isInSchedule(new GlideDateTime(gs.nowDateTime()))) {
}
Error coming system giving nowDateTime() not allowed in Scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 09:22 PM
Try just
if (schedule.isInSchedule(new GlideDateTime())) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 09:02 AM
It's returning UTC time value but I'm looking at EST timezone value validation.
I tried below , but it's always entering into false.
var now= new GlideDateTime();
var nowDate = new GlideDateTime(now.getDisplayValueInternal());
var schedule = new GlideSchedule("090eecae0a0a0b260077e1dfa71da828"); 8-5 working days sys-id I took
if (schedule.isInSchedule(nowDate)) {
gs.info('It is in Schedule');
}else{
gs.info('It is Not in Schedule ');
}
always returning ' It is Not in Schedule '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 09:15 PM - edited 04-12-2024 09:17 PM
Ahh, yes, dates are a pain:
if (schedule.isInSchedule(new GlideDateTime().getDisplayValue())) {
the "getDisplayValue" will get the date/time in the User's timezone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2024 10:16 PM
if (schedule.isInSchedule(new GlideDateTime().getDisplayValue())) {
system giving Error Message : in Scoped Application 'String' value not allowed schedule.isInSchedule(string)