Schedule Entry - The dates and times you entered were not valid

joonas5
Kilo Expert

Hi,

I'm creating a maintenance calendar where users could check and book maintenance works. I created it to Maintenance schedules -> Maintenance calendar

I'm trying to create a new service catalog page where users could book a maintenance schedule for maintenance. Service catalog page doesn't create a new reservation because when trying to submit the error occurs: "The dates and times you entered were not valid". Any ideas?

Capture6.PNG

                              And here is the service catalog view:

Capture3.PNG

and the following error occurs:

Capture2.PNG

Thanks,

Joonas

7 REPLIES 7

joonas5
Kilo Expert

I have found the business rule (Schedule Item validate) which is calling a Script Include (ScheduleEntryValidation) which has the following if statement which is causing the error message:



Capture.PNG



Any ideas? All help is appreciated!



Joonas


Date selector variable is available with following data type.



find_real_file.png



Regards,


Sachin


Jamison Cote1
Tera Contributor

In case anyone sees this now... The below script works.

 

You need to use the GlideScheduleDateTime() class to insert schedule entries via a script:

 

 

 

var startGSDT = new GlideScheduleDateTime("20231125T150000Z");
var endGSDT = new GlideScheduleDateTime("20231205T150000Z");

var schedule = new GlideRecord("cmn_schedule_span");
schedule.initialize();
schedule.show_as = "busy";
schedule.start_date_time = startGSDT;
schedule.end_date_time = endGSDT;
schedule.schedule = "schedule sys id";
schedule.insert();