ere’s a very cool (and simple) secret that allows you to show and hide loading dialog screens. These scripts can be run from anywhere in your system that supports client-side javascript.

You’ve probably seen these used in various places in your ServiceNow instance.

Long Loading Form Dialog

To show a loading dialog…

//Show the loading dialog immediately as the form loads
var loadingDialog = new GlideDialogWindow("dialog_loading", true);
loadingDialog.setPreference('table', 'loading');
loadingDialog.setTitle('Loading...'); //Set the loading dialog title here...

To hide that same loading dialog…


For a practical example of how this could be used, check out the ‘Restrict Report Table Selection by Role’ article here on SNGuru. That solution requires some pretty heavy client-side Javascript that could take a while to execute in certain circumstances. Because of this, it was important that I let the user know that there was something happening that they needed to wait on.

Another great example is a customization I created to deal with long-loading forms. The customization required that a loading dialog be displayed before the form loaded, and that the loading dialog be destroyed when everything on the form finished.