Deluge Script Appointment Booking | Created Validations on form submission | Run Scripts - While Adding a Record

PHOTO EMBED

Mon May 08 2023 01:19:38 GMT+0000 (Coordinated Universal Time)

Saved by @SapphireElite #iframe

if(input.Schedule_Date_Time <= zoho.currenttime && input.Schedule_Date_Time < zoho.currenttime.addHour(1))
{
	alert "Booking can be done prior to 1 hour";
	cancel submit;
}
if(!thisapp.Util.CheckAvailability(input.Staff_Name,input.Schedule_Date_Time,input.Schedule_upto))
{
	alert "The Time Slot You Booked is Not Available or Your Time Exceeds Staff's Availability Time. <br> Please Try Other Time Slots.";
	cancel submit;
}
getAppointments = Appointment_Booking[ID != 0] sort by Added_Time desc;
if(getAppointments.count() == 0)
{
	input.Booking_Id = "0001";
}
else
{
	num = getAppointments.Booking_Id.toLong();
	num = num + 1;
	input.Booking_Id = leftpad(num.toString(),4).replaceAll(" ","0");
}
content_copyCOPY

https://creator.zoho.com/appbuilder/sapphireelitetech/appointment-management/workflowbuilder/Run_Scripts_While_Adding_21/edit