- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 01:17 AM
I have a requirement in Change Request that is if the Planned end date is less than the Actual end date then I need to trigger notification. How to compare the two date/time fields?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 01:38 AM
@Admin7267 : you can use Client Script of type onSubmit with the following code:
var plannedDate = new GlideDateTime(current.planned_end_date);
var actualDate = new GlideDateTime(current.actual_end_date);
if (plannedDate.before(actualDate))
{
gs.addInfoMessage("Planned End Date is before Actual End Date.");
}
inplace of gs.addInfoMessage you can use a logic to trigger your notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 02:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 01:36 AM
Hello @Admin7267
In your question there are so many open questions like:
1) When you want this action to be performed?
2) Are you thinking for all CHG records?
3) Do you want this only when record is getting updated?
To compare the Planned end date and Actual end date in a Change Request and trigger a notification if the Planned end date is less than the Actual end date, you can use a Business Rule.
In case if you are looking only for validation of two fields when it's entered then you can write Ui Policy and compare each other.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 01:37 AM
Hi @Admin7267
Try this way
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 01:38 AM
@Admin7267 : you can use Client Script of type onSubmit with the following code:
var plannedDate = new GlideDateTime(current.planned_end_date);
var actualDate = new GlideDateTime(current.actual_end_date);
if (plannedDate.before(actualDate))
{
gs.addInfoMessage("Planned End Date is before Actual End Date.");
}
inplace of gs.addInfoMessage you can use a logic to trigger your notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 02:13 AM