Showing only guests with reservations

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.

  1. 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 ...

Get ServiceNow: Building Powerful Workflows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.