Using GlideForm

GlideForm provides getter and setter methods that provide access to the record as it is displayed on the screen. Let's run some code in the JavaScript executor in order to understand what options are available.

  1. Navigate to a new Check-in record (Hotel > Check-ins, then press New). Populate the form as follows, but you don't need to save.
    • Room: 301 (you may need to create it)
  1. The aim is to ensure the floor field is populated. Once done, press Ctrl + Shift + J to launch the JavaScript Executor.
  2. Use the following code, then click on Run:
var floor = g_form.getValue('room.floor'); if (floor > 2) { g_form.showFieldMsg('room.floor', 'This is a high floor!'); g_form.setDisplay('comments', true); g_form.setValue('comments', ...

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.