How to trigger task before 1 Business day

Mohammed20
Tera Contributor
Hi,
 
I added the script below in timer activity which is working fine and creating task one day before business day in our dev instance but the same script is not working in test instance, is in the script anything missing?
 
please help on this. Thank you!
answer = 0;
var gdttime = new GlideDateTime();
gdttime.setDisplayValue(current.variables.new_start_date.getDisplayValue());
gs.log("time check: "+gdttime );
gdttime.addaddDays(-1);
var schedulebd = new GlideSchedule('af4477491bad5e10883f11f2b24bcbab');
while (!schedulebd.isInSchedule(gdttime)) {
gs.log("schedule check: "+schedulebd);
gdttime.addDays(-1);
}
//answer = gdttime.getNumericValue();
answer = gs.dateDiff(new GlideDateTime(), gdttime, true);
gs.log("task created one day before business days: "+answer);