trigger a notification on the change_request if the Planned End Date has only 3 hours remaining
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2023 02:19 PM
Hello,
I'm looking for a solution to trigger a notification on the change_request when the Planned End Date is only 3 hours away. I have tried using GlideDateTime, subtracting time, and gs.eventQueueScheduled, but I seem to be missing something each time. I want to ensure that the notification only triggers if the Change Request is not closed, even if I schedule an event, and the user completed the change, he will still receives the notification. We only want notification to trigger if the state is not closed complete. Could someone please assist me in achieving this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2023 08:41 PM
Hi there,
"even if I schedule an event, and the user completed the change, he will still receives the notification"
You can add a condition? To check if the Change Request is active or not?
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2023 08:48 PM
Hello @Saurav Bhardwa2
You can try Mark's suggestion. If that's not working, could you pls provide your script.
Kind Regards,
Ravi Chandra.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2023 09:37 PM
Hello Ravi,
I am using this script in Insert and update operation BR
Below is the trigger in snip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2023 10:05 PM
Hello @Saurav Bhardwa2
You can try using log statements and check the updateEnd value.
also try adding this line before gs.eventQueueScheduled method
var gdt = new GlideDateTime(updatedEnd).
please hit the Thumb Icon and mark as Correct if it helped !!
Regards,
Ravi Chandra.