- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 12:19 PM
Hi Experts!
I made business rule that count the number of days between two dates and it works but I would like to know how to exclude weekends
for example if te user put 24-04-2020 in 'comienzo' field and 28-04-2020 in 'Fin' field the script returns 4 days but there is a weekend between these dates, so, How can I exclude that weekend? and the script returns 2 days. Same example for holidays like July 5th.
If anyone knows how I could do this I would really appreciate it!
thanks so much!!
(function executeRule(current, previous /*null when async*/) {
var realCom = new GlideDate();
realCom.setDisplayValue(current.u_comienzo_real.getDisplayValue()); //Field comienzo
var realFin = new GlideDate();
realFin.setDisplayValue(current.u_fin_real.getDisplayValue()); //Field Fin
var seconds = gs.dateDiff(realCom,realFin,true);
var value = Math.floor(seconds/86400);
var x = parseInt(value,10);
current.setValue("u_duracion_real_dias",x + " DĂas");
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 12:50 PM
HI,
Check this:
Basically you need to use schedule to calculate this date.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 01:43 PM
Hi rajneeshbaranwal!
I did something similar and it worked, only with some settings according to the script