ClinicOffice Support Forum • View topic - How to make a field mandatory in the Appointment Editor?

How to make a field mandatory in the Appointment Editor?

Scripting help and sample scripts for use with the Scripting Module
Forum rules
*** NOTE: This is our OLD FORUM WEBSITE *** Please go to https://pioneersoftware.co.uk/forums

How to make a field mandatory in the Appointment Editor?

Postby Support » June 5th, 2017, 10:37 am

This example will show how to make the ROOM field mandatory on the Appointment Editor.

[1] Click TOOLS | SCRIPT EDITOR to show the Script Editor screen

[2] Locate "frmEditorApp" and the "OnBeforeSaveRecord" event

[3] Copy & Paste the following script into the Script Editor :-

Code: Select all
frmEditorBaseRec Editor = (Params[0] as frmEditorBaseRec);
cApp app = (Editor.Record as cApp);
if (app.room_id == null)
{
  throw new PSExc.FriendlyException("Please enter a ROOM for this Appointment", "Room is Required");
}

This example works on the "app.room_id" field but you could edit this script to work on a different field, for example change "app.room_id" to "app.staff_id" to enforce a STAFF MEMBER, or "app.apptype_id" to enforce an APPOINTMENT TYPE.

We hope this is helpful! Please feel free to post a reply if you have any questions or need something to be clarified!
ClinicOffice Support Team
User avatar
Support
Site Admin
 
Posts: 888
Joined: August 25th, 2005, 6:37 pm

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron