How to find the closest schedule date with my planned start date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 11:24 AM
my change request planned start date : 2024-03-20 01:00:00
Script: overlapSpan Dates: 2024-04-03 01:00:00
Script: overlapSpan Dates: 2024-03-27 01:00:00
Script: overlapSpan Dates: 2024-04-10 01:00:00
To my planned start date : 2024-03-20 01:00:00 the closest overlapSpan Date is 2024-03-27 01:00:00
How to find this via scripting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 12:00 PM
Hi @surya76,
If you are using the GlideRecord query to fetch the records, you can do something like below;
var chgGr = new GlideRecord('change_request');
chgGr.addEncodedQuery("start_date>=javascript:gs.dateGenerate('add your date here')");
chgGr.orderBy('start_date');
chgGr.setLimit(1);
chgGr.query();
if (chgGr.next()) {
return chgGr.getValue('start_date');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 12:13 PM
were do you get this dates from ?
Script: overlapSpan Dates: 2024-04-03 01:00:00
Script: overlapSpan Dates: 2024-03-27 01:00:00
Script: overlapSpan Dates: 2024-04-10 01:00:00
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....