Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to find the closest schedule date with my planned start date

surya76
Tera Contributor

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?

2 REPLIES 2

James Chun
Kilo Patron

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');
}

Sohail Khilji
Kilo Patron

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....

LinkedIn - Lets Connect