Need help on date validation

Anirudh_saraf
Tera Contributor

Hi All, 

 

I have a requirement as follows

 

Add validation that can only be selected after 12 business days (from the 13th business day) from the date of application 

 

Please let me know how to achieve the following thanks

6 REPLIES 6

Najmuddin Mohd
Mega Sage

HI @Anirudh_saraf ,
You can use GlideSchedule API()

 

Create a Schedule which contains business days

Include the schedule in the script include and you can validate from Client script and validate the date.

Example:

var startDate = new GlideDateTime('2014-10-16 02:00:00');
var endDate = new GlideDateTime('2014-10-18 04:00:00');
var schedule = new GlideSchedule();
 
schedule.load('090eecae0a0a0b260077e1dfa71da828'); // loads "8-5 weekdays excluding holidays" schedule
var duration = schedule.duration(startDate, endDate);
gs.info(duration.getDurationValue()); // gets the elapsed time in schedule

 

If this information helps you, kindly mark it as Helpful and Accept the solution.

Regards,
Najmuddin.

Hi @Anirudh_saraf ,
Did the above solution did not work ?

Regards,
Najmuddin.

 

Hi Najmuddin Mohd,
Thanks or your reply. If you can please elobarate it as I am new to work with these  ,it would be really helpul. Thanks .
Preview
 
 
 

,

 

Amit Verma
Kilo Patron
Kilo Patron

Hi @Anirudh_saraf 

 

You can create a UI policy for this. Refer https://www.servicenow.com/community/itsm-forum/validation-on-date-field-to-allow-users-to-only-sele...

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.