Create a before insert business rule on the service table to automatically adds a variable for service catalog in the appointment booking table. This ensures that the variable record is visible on the appointment calendar for
users when booking an appointment.
Before you begin
Role required: admin
Procedure
-
Navigate to .
-
Click New.
-
In the Name field, enter your business rule name.
-
Select your service table from the Table list.
-
Select Advanced.
-
On the When to run tab, in the When condition select
before and select the insert check box.
This action specifies that the business rules should run before the insert.
-
On the Advanced tab, add your condition in the Condition field.
For example, add current.variables.sn_appointment in the Condition field.
-
Enter the script in the Script field that you want to run when the defined condition is true.
For example, add the below script to creates appointment
record.
(sn_apptmnt_booking.AppointmentBooking_Factory().getWrapperType(sn_apptmnt_booking.AppointmentBookingConstants.APPOINTMENT_BOOKING_IMPL);
var sn_appointmentJSON = JSON.parse(sn_appointment);
// creating an appointment <br>
var appointmentId = helper.submitAppointmentFromPortal(sn_appointment, current, sn_appointmentJSON.config.opened_for, sn_appointmentJSON.config.location, current.short_description);
)
-
Click Submit.
For more information on other fields of this form, see .