Related lists aren't loading when a record is opened: "Uncaught ReferenceError: gs is not defined"


Description

Symptoms


Related lists aren't loading when a record is opened and right clicking the field labels doesn't show the expected menu: Configure Label, Configure Dictionary, etc. and the Chrome browser console logs show:
Uncaught ReferenceError: gs is not defined

Release


All releases.

Cause


gs (GlideSystem - Scoped) is available only to server-side scripts but isn't available to client-side scripts such as those used in a client script or UI policy.

Resolution


Check for any client scripts or UI policies that might be making calls using gs. Replace all gs calls in a client script or UI policy script with the corresponding g_form (GlideForm - Client) call. g_form is available to client-side scripts.
 
Here are links to available methods for each:
 
GlideSystem - Scoped
 
GlideForm - Client
 
After replacing all gs calls in client scripts and UI policy scripts with the corresponding g_form call, flush the cache. If doing this on a production instance, it's recommended to schedule this for off-peak hours because flushing the cache can cause some temporary performance degradation while the caches get rebuilt. To flush the cached, in the Filter navigator field, enter cache.do