This cheat sheet lists the 100 ServiceNow Glide API methods The Snowball documents, across GlideAggregate, GlideDateTime, GlideForm, GlideRecord, GlideSystem, GlideUser. Each row gives the call signature, what it returns and its parameters, and links to a full page with code examples and gotchas.
Records last updated March 9, 2026. Written by The Snowball, not by ServiceNow: behaviour can change between releases, so check the official ServiceNow API reference for your release.
Machine-readable copies: Markdown · JSON. Table schema data: tables (Markdown) · tables (JSON). Free to reuse under CC BY 4.0: name The Snowball and link this page.
GlideAggregate (6 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| ga.addAggregate(aggregateType, field) | void | aggregateType: stringfield: string (optional) | Adds aggregate operations (COUNT, SUM, MIN, MAX, AVG) to GlideAggregate queries. Essential for reporting and analytics. |
| ga.addQuery(name, value) | GlideQueryCondition | name: stringvalue: string | Filter your GlideAggregate results with addQuery(). Works identically to GlideRecord.addQuery() but for aggregate queries. Returns GlideQueryCondition. |
| ga.getAggregate(aggregateType, field) | string | aggregateType: stringfield: string | Returns the result of an aggregate function as a string. Must be called after next() to get values for the current group. |
| ga.groupBy(fieldName) | void | fieldName: string | Groups GlideAggregate results by field for COUNT, SUM, and other aggregates. Essential for reports broken down by category or assignment group. |
| ga.orderByAggregate(aggregateType, field) | void | aggregateType: stringfield: string | Orders GlideAggregate grouped results by aggregate values. Essential for finding top-N groups like assignment groups with most incidents or users with highest scores. |
| ga.setGroup(isGrouped) | void | isGrouped: boolean | Control whether GlideAggregate groups results or returns a single aggregate across all records. Essential for handling totals vs grouped calculations. |
GlideDateTime (13 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| gdt.addDays(days) | void | days: number | Add days to a GlideDateTime object in ServiceNow. Handles month boundaries and leap years automatically. Modifies the object in place. |
| gdt.addSeconds(seconds) | void | seconds: number | Add or subtract seconds from a GlideDateTime object. Accepts negative values for subtraction. Essential for precise time calculations in ServiceNow. |
| gdt.after(other) | boolean | other: GlideDateTime | Compare GlideDateTime objects to check if one comes after another. Essential for date range validation, SLA calculations, and workflow logic in ServiceNow. |
| gdt.before(other) | boolean | other: GlideDateTime | Compare GlideDateTime objects chronologically. Returns true if this datetime is before another. Clean alternative to numeric comparisons. |
| gdt.compareTo(other) | number | other: GlideDateTime | Compare two GlideDateTime objects for chronological order. Returns negative, zero, or positive values for sorting and three-way date comparisons. |
| gdt.getDayOfMonth() | number | none | Get the day of month (1-31) in UTC from a GlideDateTime. Returns number, not string. Use getDayOfMonthLocalTime() for user timezone conversion. |
| gdt.getDisplayValue() | string | none | Returns GlideDateTime formatted for the current user's timezone and display preferences. Essential for user-facing date/time output in ServiceNow. |
| gdt.getMonthValue() | number | none | Get the month (1-12) from a GlideDateTime in UTC. Returns integer from 1 (January) to 12 (December). Essential for date filtering and calculations. |
| gdt.getNumericValue() | number | none | Convert GlideDateTime to milliseconds since Unix epoch. Essential for duration calculations and date comparisons in ServiceNow server scripts. |
| gdt.getValue() | string | none | Get the internal string representation of a GlideDateTime in UTC format. Returns yyyy-MM-dd HH:mm:ss for database storage and comparisons. |
| gdt.getYearValue() | number | none | Extract the four-digit year from a GlideDateTime object in UTC. Essential for date calculations, reporting filters, and business rules. |
| gdt.setDisplayValue(value) | void | value: string | Sets date/time from display-format string in user's timezone. ServiceNow converts to UTC internally. Essential for handling user date input. |
| gdt.setValue(value) | void | value: string | Date | GlideDateTime | Sets GlideDateTime value from string, JavaScript Date, or GlideDateTime. Converts to UTC internally. Complete guide with gotchas and working examples. |
GlideForm (21 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| g_form.addErrorMessage(message) | void | message: string | Display red error messages at the top of ServiceNow forms. Essential for client-side validation and user feedback in forms. |
| g_form.addInfoMessage(message) | void | message: string | Display blue info messages at the top of ServiceNow forms. Learn proper usage, scope limitations, and when to use alternatives like showFieldMsg(). |
| g_form.clearMessages() | void | none | Remove all info and error messages from ServiceNow forms. Essential client-side method for clearing notification messages after validation or updates. |
| g_form.clearValue(fieldName) | void | fieldName: string | Clears field values on ServiceNow forms, including both display and sys_id for reference fields. Essential for dynamic form behavior in client scripts. |
| g_form.flashField(fieldName, color, count) | void | fieldName: stringcolor: stringcount: number | Flash a field with color to draw user attention. Covers hex colors, flash count, timing behavior, and when to use this advanced UI feedback technique. |
| g_form.getControl(fieldName) | HTMLElement | fieldName: string | Returns the DOM element for a field's input control. Use for direct DOM manipulation when standard GlideForm APIs aren't sufficient. |
| g_form.getDisplayValue(fieldName) | string | fieldName: string | Returns the display label for any field. Gets reference record display names and choice field labels, not the underlying values stored in database. |
| g_form.getReference(fieldName, callback) | void | fieldName: stringcallback: function | Asynchronously fetch referenced records from the client-side with full display values. Essential for loading reference data in UI scripts. |
| g_form.getTableName() | string | none | Returns the table name of the current form in client scripts. Essential for shared code that handles multiple table types in ServiceNow. |
| g_form.getUniqueValue() | string | none | Returns the sys_id of the current record in client-side scripts. Essential for identifying records in UI Policies, Client Scripts, and UI Actions. |
| g_form.getValue(fieldName) | string | fieldName: string | Returns the internal value of form fields. For reference fields returns sys_id, for choice fields returns stored value. Essential client-side method. |
| g_form.hideFieldMsg(fieldName, clearAll) | void | fieldName: stringclearAll: boolean (optional) | Hides field-level messages in ServiceNow forms. Control whether to clear just the latest message or all messages for a field. Client-side only. |
| g_form.save() | void | none | Save a form without navigation in ServiceNow. Triggers all save Business Rules and UI Policies while keeping users on the current record. |
| g_form.setLabel(fieldName, label) | void | fieldName: stringlabel: string | Dynamically change field labels on ServiceNow forms at runtime. Client-side only, temporary changes that don't affect the data dictionary. Complete reference. |
| g_form.setMandatory(fieldName, mandatory) | void | fieldName: stringmandatory: boolean | Make ServiceNow form fields required or optional client-side with g_form.setMandatory(). Client-only changes that don't affect server validation. |
| g_form.setReadOnly(fieldName, readOnly) | void | fieldName: stringreadOnly: boolean | Make form fields read-only on the client side. Client-only enforcement - combine with ACLs for real security. |
| g_form.setSectionDisplay(sectionName, display) | boolean | sectionName: stringdisplay: boolean | Hide or show entire form sections dynamically with setSectionDisplay(). Returns boolean success status. Handles section name translation automatically. |
| g_form.setValue(fieldName, value, displayValue) | void | fieldName: stringvalue: string | number | booleandisplayValue: string (optional) | Set field values on forms without saving in ServiceNow. Essential for client scripts, UI policies. Handles reference fields, display values, validation. |
| g_form.setVisible(fieldName, display) | void | fieldName: stringdisplay: boolean | Show or hide form fields client-side in ServiceNow. Controls display without affecting values. Essential for dynamic forms and conditional visibility. |
| g_form.showFieldMsg(fieldName, message, type) | void | fieldName: stringmessage: stringtype: string | Display contextual info or error messages directly under specific fields. More precise than global messages for field validation and user guidance. |
| g_form.submit() | void | none | Submits the form and navigates away after save, equivalent to clicking Save. Essential for custom client-side form submission patterns. |
GlideRecord (40 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| addActiveQuery() | void | none | Shorthand for addQuery('active', true) that filters GlideRecord queries to only return active records. Essential method for most data queries. |
| addEncodedQuery(query) | void | query: string | Adds encoded query strings to GlideRecord filters. Copy queries from UI filter breadcrumbs. Chain multiple conditions with AND logic. |
| addJoinQuery(joinTable, primaryField, joinTableField) | GlideQueryCondition | joinTable: stringprimaryField: stringjoinTableField: string | Adds a JOIN query to your GlideRecord, returning a GlideQueryCondition for filtering on the joined table. Essential for complex multi-table queries. |
| addNotNullQuery(fieldName) | GlideQueryCondition | fieldName: string | Adds IS NOT NULL condition to GlideRecord queries. Essential for filtering out empty reference fields and null values. Returns GlideQueryCondition. |
| addNullQuery(fieldName) | GlideQueryCondition | fieldName: string | Add IS NULL conditions to GlideRecord queries in ServiceNow. Returns GlideQueryCondition for chaining. Equivalent to addQuery(field, 'ISEMPTY', ''). |
| addOrCondition(name, value) | GlideQueryCondition | name: stringvalue: string | number | boolean | Adds OR conditions to GlideRecord queries by chaining off the GlideQueryCondition returned by addQuery. Essential for complex query logic in ServiceNow. |
| addQuery(name, value) | GlideQueryCondition | name: stringvalue: string | number | boolean | Adds WHERE conditions to GlideRecord queries. Returns GlideQueryCondition for OR chaining. Essential method for filtering records in ServiceNow. |
| addQuery(name, operator, value) | GlideQueryCondition | name: stringoperator: stringvalue: string | number | boolean | Add WHERE conditions to GlideRecord queries with explicit operators. Returns GlideQueryCondition for chaining and OR operations. Server-side only. |
| autoSysFields(enable) | void | enable: boolean | Controls whether ServiceNow auto-updates sys_updated_on, sys_updated_by, and sys_mod_count on GlideRecord operations. Essential for data migrations. |
| canRead() | boolean | none | Check if current user has read access to a GlideRecord without throwing ACL errors. Returns boolean true/false for secure permission testing. |
| canWrite() | boolean | none | Check if current user can write to a GlideRecord before setValue/update. Prevents silent permission failures and ACL violations in server-side scripts. |
| chooseWindow(firstRow, lastRow) | void | firstRow: numberlastRow: number | Paginate GlideRecord results by specifying a zero-indexed row window. Essential for processing large datasets without memory exhaustion in ServiceNow. |
| deleteMultiple() | void | none | Bulk delete all ServiceNow records matching a query without Business Rules or notifications. Dangerous but fast. Learn safe patterns and gotchas. |
| deleteRecord() | boolean | none | Deletes the current GlideRecord from the database. Returns true on success. Triggers delete business rules and requires delete ACL permissions. |
| get(sys_id) | boolean | sys_id: string | Retrieves a single ServiceNow record by sys_id. Returns boolean. More efficient than query() for single-record lookups. Essential GlideRecord method. |
| getDisplayValue(fieldName) | string | fieldName: string | Returns human-readable display values for reference fields and choice labels. Essential for UI display and reporting in ServiceNow server-side scripts. |
| getEncodedQuery() | string | none | Returns the current GlideRecord query as an encoded query string. Essential for debugging queries, passing filters to other methods, and understanding what your query actually contains. |
| getRecordClassName() | string | none | Returns the actual table name of the current record, different from getTableName() when working with extended tables. Essential for polymorphic queries. |
| gr.fieldName.getRefRecord() | GlideRecord | none | Get the referenced GlideRecord from a reference field without a second query. Essential method for efficient reference field data access in ServiceNow. |
| getRowCount() | number | none | Returns the number of records in a GlideRecord result set. Runs the full query to count rows. Use GlideAggregate for better performance on count-only operations. |
| getTableName() | string | none | Returns the table name a GlideRecord was instantiated against. Essential for debugging and dynamic table operations in ServiceNow server-side scripts. |
| getUniqueValue() | string | none | Returns the sys_id of the current GlideRecord. More readable than getValue('sys_id'). Essential for record lookups and relationship building in ServiceNow. |
| getValue(fieldName) | string | fieldName: string | Returns the internal value of a field as a string. For reference fields returns sys_id. Always returns string type even for integers and booleans. |
| hasNext() | boolean | none | Check if more records exist in your GlideRecord query without advancing the cursor. Returns boolean. Server-side only. Rarely needed — prefer next() instead. |
| initialize() | void | none | Resets GlideRecord for new inserts by clearing all field values. Essential for reusing GlideRecord objects in loops to prevent data carryover between iterations. |
| insert() | string | none | Creates a new record in the database and returns its sys_id. Triggers Business Rules and ACL checks. Essential for programmatic record creation. |
| isNewRecord() | boolean | none | Returns true if the GlideRecord hasn't been saved to the database yet. Essential for distinguishing insert vs update operations in Business Rules. |
| isValid() | boolean | none | Returns true if the GlideRecord was instantiated against a valid table. Essential validation check—doesn't mean records exist, just that the table does. |
| isValidField(fieldName) | boolean | fieldName: string | Check if a field exists on a GlideRecord table before accessing it. Essential for dynamic field access across scopes and table versions in ServiceNow. |
| next() | boolean | none | Moves the GlideRecord cursor to the next record in the result set. Returns true if a record exists, false when no more records. Essential for iteration. |
| orderBy(fieldName) | void | fieldName: string | Sort GlideRecord query results in ascending order by field name. Essential for consistent data ordering in ServiceNow server-side scripts. |
| orderByDesc(fieldName) | void | fieldName: string | Sort GlideRecord query results in descending order by field. Essential for displaying newest records first in ServiceNow server-side scripts. |
| query() | void | none | Executes the GlideRecord database query. Required before next() iteration. No-op in before Business Rules. Essential reference for ServiceNow developers. |
| setAbortAction(b) | void | b: boolean | Cancel database operations in Business Rules with setAbortAction(). The standard way to validate data and block saves before they hit the database. |
| setDisplayValue(fieldName, value) | void | fieldName: stringvalue: string | Sets a GlideRecord field by display value instead of sys_id. ServiceNow resolves display names to internal values on save. Perfect for reference fields. |
| setLimit(maxNumRecords) | void | maxNumRecords: number | Limits the number of records returned by a GlideRecord query. Must be called before query(). Critical for performance when you only need first N records. |
| setValue(fieldName, value) | void | fieldName: stringvalue: string | number | boolean | Sets field values in memory for GlideRecord objects. Does not save to database until update() or insert() is called. Essential for data manipulation. |
| setWorkflow(enable) | void | enable: boolean | Control Business Rule execution during GlideRecord operations. Pass false to suppress workflows for data migrations and bulk updates. Server-side only. |
| update(reason) | string | reason: string (optional) | Updates the current GlideRecord and returns sys_id or null. Triggers Business Rules, writes audit history, requires valid record state. |
| updateMultiple() | void | none | Bulk update all matching records efficiently without Business Rules. Critical for performance on large datasets. Bypasses ACL checks and audit. |
GlideSystem (19 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| gs.addErrorMessage(message) | void | message: string | Display red error banners to users in ServiceNow. Does not prevent saves - combine with setAbortAction(true) to block operations. Server-side only. |
| gs.addInfoMessage(message) | void | message: string | Display blue info messages to users with gs.addInfoMessage(). Server-side only. Shows after Business Rules complete. Essential for user feedback. |
| gs.error(message, parameters) | void | message: stringparameters: any (optional) | Logs messages at ERROR level in ServiceNow. Use for unexpected failures that need alerting. Doesn't throw exceptions, just logs to system logs. |
| gs.generateGUID() | string | none | Generate a 32-character GUID string without hyphens for unique identifiers outside database inserts. Returns random string using platform entropy. |
| gs.getCurrentScopeName() | string | none | Returns the current application scope name ('global' for global scope). Essential for building scope-aware scripts that behave differently per application. |
| gs.getProperty(key, defaultValue) | string | key: stringdefaultValue: string (optional) | Retrieves system property values from sys_properties table. Always returns string. Use for configurable values instead of hardcoding in Business Rules and Script Includes. |
| gs.getSession() | GlideSession | none | Returns the current GlideSession object to access session data, timezone, language settings, and client information in server-side scripts. |
| gs.getUser() | GlideUser | none | Get the current session user as a GlideUser object to access name, email, department, manager, and roles. Server-side only. Essential for user context. |
| gs.getUserID() | string | none | Get the sys_id of the currently logged-in user. The foundation for user-scoped queries and security checks in ServiceNow server-side scripts. |
| gs.getUserName() | string | none | Returns the user_name (login ID) of the current user. Essential for logging, audit trails, and user-specific logic in server-side scripts. |
| gs.hasRole(role) | boolean | role: string | Check if the current user has a specific role in ServiceNow. Returns true for role members and admin users. Essential for access control in scripts. |
| gs.include(name) | boolean | name: string | Load Script Includes dynamically into global scope with gs.include(). Server-side only method for runtime loading. Essential for legacy global scripts. |
| gs.info(message, parameters) | void | message: stringparameters: any (optional) | Log messages at INFO level with string substitution. Preferred over gs.log() in scoped apps. Server-side only method for debugging and auditing. |
| gs.isInteractive() | boolean | none | Returns true for user-driven UI requests, false for background jobs and API calls. Essential for conditional logic in Business Rules and Script Includes. |
| gs.log(message, source) | void | message: stringsource: string (optional) | Write messages to ServiceNow's system log table. Essential for debugging server-side scripts. View logs in System Logs > All. |
| gs.nowDateTime() | string | none | Returns current date and time as string in instance timezone. Essential for logging, timestamps, and date comparisons in server-side scripts. |
| gs.setProperty(key, value, description) | void | key: stringvalue: stringdescription: string | Creates or updates ServiceNow system properties programmatically. Use sparingly — most property changes belong in the UI, not code. |
| gs.tableExists(name) | boolean | name: string | Check if a ServiceNow table exists before querying it. Essential for dynamic code that handles optional plugins or scoped applications. |
| gs.warn(message, parameters) | void | message: stringparameters: object | string | number (optional) | Log warning messages with parameter substitution using gs.warn(). Essential for non-fatal issues that need investigation in ServiceNow server-side scripts. |
GlideUser (1 methods)
| Signature | Returns | Parameters | What it does |
|---|---|---|---|
| gs.getUser().getID() | string | none | Get the sys_id of the current user from a GlideUser object. Alternative to gs.getUserID() when working with user objects in server-side scripts. |