How to get due date of next 15 days exclude holidays and weekends

azeez
Kilo Contributor

Hello Everyone,

I want a calculate the Due date of next 15 days which must exclude the holidays and weekends.

I've been reviewing the Calculating Due Date Based on Requested Date   to figure out how to display''Due Date' in date/time variable . I think I need to create a schedule of 8-5 weekdays excluding holidays but i don't know how to design to achieve this, does anyone have any advice?

andrew.venablesjim.coynekalai

Thanks in Advance,

Abdul Azeez

1 ACCEPTED SOLUTION

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi,



Take a look at this blog post I made.. here I use relative durations (which you can create one for 15 days) And put that into a durationcalculator and a schedule to calculate the correct time.



IF you look at the script, you can use the dc.getEndDateTime() to get the end time. Let me know if you need more help with it. Not sure where you want for it, but Im guessing a catalog client script? and then you need to put this in a script include and call it from the client script.



How to close ticket after 3 business days



//Göran


View solution in original post

7 REPLIES 7

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi,



Take a look at this blog post I made.. here I use relative durations (which you can create one for 15 days) And put that into a durationcalculator and a schedule to calculate the correct time.



IF you look at the script, you can use the dc.getEndDateTime() to get the end time. Let me know if you need more help with it. Not sure where you want for it, but Im guessing a catalog client script? and then you need to put this in a script include and call it from the client script.



How to close ticket after 3 business days



//Göran


Deepak Ingale1
Mega Sage

Hi Abdul,



GlideSchedule API is what you need to try with to calculate 15th day excluding holidays and weekends.



https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_GlideScheduleScopedAPI



isInSchedule method of the API you should try with, I would set the counter of 15 and count of X.   I would increase X by 1 and will check if day is in schedule. When x value reaches 15, that would be my 15th day as per schedule.


Hi Deepak,

Can you provide me the script bro?

 

Thanks,