Let's improve the reference qualifier on the Guest field in the Check-in table so that only users who have a reservation can check in.
- Firstly, create a new Script Include. Navigate to System Definition > Script Includes and click New.
In this example, we'll create a single function for simplicity, but you could include it as part of a larger utility function.
- Name: guestsWithReservations
- Script:
function guestsWithReservations() { var result = []; var res = new GlideRecord('x_hotel_m2m_guests_reservations'); res.query(); while (res.next()) { result.push(res.guest + ''); } var au = new global.ArrayUtil(); return au.unique(result); }
This script should be very familiar from the early part of the ...