Appointment BookingCreatedSuccessful form submissionRun Scripts - While Adding a Record

PHOTO EMBED

Tue May 09 2023 02:24:39 GMT+0000 (Coordinated Universal Time)

Saved by @SapphireElite #iframe

getCustomerStats = Add_Client[Customer_Email == input.Customer_Email];
getStaffDetails = Add_Staffs[ID == input.Staff_Name];
if(getCustomerStats.count() == 0)
{
	idlist = {input.ID};
	insert into Add_Client
	[
		Name=input.Customer_Name
		Customer_Contact_Number=input.Phone_Number
		Customer_Email=input.Customer_Email
		Address=input.Address
		Added_User=zoho.loginuser
		Previous_Bookings=idlist
	]
	thisapp.appSharing.toCustomer(input.Customer_Email);
	appname = zoho.appname;
	sendmail
	[
		from :zoho.adminuserid
		to :input.Customer_Email
		subject :"Invitation to access '" + zoho.appname + "' "
		message :"<div style='width:100%;display:inline-block;box-sizing:border-box;border:1px solid #ddd;'><div style='padding:2%;text-align:center;'>You've been invited to use an application built on Zoho Creator by \"" + zoho.adminuserid + "\".</div><div style='background: #efefef; padding: 20.0px;margin: 20.0px 0 10.0px;text-align:center;'><h2>" + appname.toUpperCase() + "</h2><div style='margin: 20.0px 0 10.0px;'><a style='padding:10px;background-color: rgb(62,149,205);text-decoration: none;color: rgb(255,255,255);font-size: 14.0px;' href='https://creator.localzoho.com" + zoho.appuri + "' target='_blank'> Go to application </a></div></div></div>"
	]
}
else
{
	templist = getCustomerStats.Previous_Bookings;
	templist.add(input.ID);
	getCustomerStats.Previous_Bookings=templist;
}
success message "Your Booking ID is #" + input.Booking_Id;
str = (("Dear " + input.Customer_Name) + ", your Booking is confirmed with " + getStaffDetails.Name) + " on " + input.Schedule_Date_Time + " upto " + input.Schedule_upto + " your booking id is #" + input.Booking_Id;
resp = zoho.sms.send(input.Phone_Number,str);
sendmail
[
	from :zoho.adminuserid
	to :input.Customer_Email
	subject :"Your Booking has been confirmed"
	message :(("<div> Dear " + input.Customer_Name) + ",</div><br><div>Thanks for choosing our service.Your booking has been confirmed on <b>" + input.Schedule_Date_Time + "</b> with " + getStaffDetails.Name) + ". your Booking ID is #" + input.Booking_Id + "</div><br><div>Thanks and Regards,</div>" + zoho.adminuser
]
getReccount = Appointment_Booking[ID != 0 && Customer_Email == zoho.adminuserid];
if(getReccount.count() != 0)
{
	openUrl("#Page:Customer_Page","same window");
}
else
{
	openUrl("#Report:My_Bookings","same window");
}
content_copyCOPY