IT CanvassTalk to an advisor
ServiceNow Cheat Sheets · LessonReviewed by Sneha I, ServiceNow Trainer, 8 yrs · Updated · Published · current release · reference

ServiceNow Scripting cheat sheet

Client vs server context and the objects you use.

Quick answer

Where ServiceNow code runs decides which objects exist. Server side: gs for logging, user and utilities, GlideRecord for the database, current and previous inside business rules. Client side: g_form to read and write form fields, g_user for the current user, GlideAjax to call the server. Security and data integrity belong on the server; the client is only for UX.

Key takeaways
  • Server side
  • Client side
  • Rule of thumb

Know where your code runs and which objects are available.

Server side

  • gs, logging, user, utilities.
  • GlideRecord, database access.
  • current / previous, in business rules.

Client side

  • g_form, read/write fields on the form.
  • g_user, current user info.
  • GlideAjax, call the server.

Rule of thumb

Security and data integrity belong on the server. The client is only for UX.

Practise this on your own free instance.
Set up your free instance →
Already working on ServiceNow and stuck on a live ticket?Get an expert ServiceNow developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support