Server-Side Scripting GlideSystem and GlideRecord Flashcards

(51 cards)

1
Q

It is a collection of methods, executes server-side and has access system-level information.

A

GlideSystem API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Returns information about the currently logged in user.

A

User Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Retrieves the current user object

A

gs.getUser()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Gets the username of the current user

A

gs.getUserName()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Retrieves the ID of the current user

A

gs.getUserID()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Gets the display name of the current user

A

gs.getUserDisplayName()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Checks if the current user has a specific role

A

gs.hasRole()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Checks if the current user has a role in a specified group

A

gs.hasRoleInGroup()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Primarily work with form objects, tables, fields, and logging

A

System Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Gets the value of a specified system property

A

gs.getProperty()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Retrieves the display column name for a given table and column name

A

gs.getDisplayColumn()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Checks if a specified table exists in the system

A

gs.tableExists()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Used to check for null or empty values

A

gs.nil()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Prints messages to the system log

A

gs.print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Logs informational messages

A

gs.info()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Logs messages with default log level

A

gs.log()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Returns the start and end of the last calendar week relative to the current date.

A

gs.beginningOfLastWeek() and gs.endOfLastWeek():

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Returns the start and end of the next calendar month relative to the current date.

A

gs.beginningOfNextMonth() and gs.endOfNextMonth()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Returns the current date and time in UTC as a string (e.g., “2024-09-09 14:25:00”).

A

gs.now()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Returns the current date and time in UTC, similar to gs.now(). Used here for clarity.

A

gs.nowDateTime()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Returns the date and time for a specified number of minutes ago from the current time.

A

gs.minutesAgo()

22
Q

Returns the date and time for a specified number of quarters (approximately 3 months) ago.

A

gs.quartersAgo()

23
Q

Returns the date and time for a specified number of months ago.

A

gs.monthsAgo()

24
Q

Returns the date and time for a specified number of years ago.

A

gs.yearsAgo()

25
Used to manipulate date and time values
GlideDate and GlideDateTime
26
Used when developing scripts for scoped applications.
Scoped GlideSystem
27
Provides methods for accessing system-level information in scoped applications
Scoped GlideSystem
28
Where to navigate to review log message output?
System Logs
29
Checks if the debugging mode is currently enabled. Useful for conditionally logging debug information
gs.isDebugging()
30
Logs debug-level messages. These are only visible when debugging is enabled.
gs.debug()
31
Logs error messages. These are typically used to log exceptions or critical issues that need attention.
gs.error()
32
Logs informational messages. Useful for general info that might be useful for understanding what the script is doing.
gs.info()
33
Logs warning messages. These indicate potential issues or important notices that aren’t errors but are worth noting.
gs.warn();
34
T or F: Whenever possible, use the GlideDateTime methods rather than JavaScript date methods for convenience
True
35
Where to check for the latest information on the GlideSystem and Scoped GlideSystem APIs and their methods
ServiceNow Developer's portal
36
Used for database operations instead of writing SQL queries.
GlideRecord
37
Where does GlideRecord executes?
Server-side
38
Builds a SQL select statement (not seen by the user)
addQuery()
39
T or F: addQuery() calls are automatically AND'ed
True
40
Method to execute the query. Returns zero or more records
query()
41
Method that moves to the next record in the GlideRecord object
next()
42
Method that iterates through all returned records.
while()
43
Method processes only the first record returned.
if()
44
Method that steps through returned records and determines if there are any more records
hasNext()
45
Method to save changes to the records in the GlideRecord. If the record does not exist, it is inserted
update()
46
Method to add a second condition to a select statement using OR
addOrCondition()
47
Use to query for a Single Record
get()
48
less code, but larger performance impact 
getRowCount()
49
more code, but executes faster 
GlideAggregate()
50
Method to build an Encoded Query
addEncodedQuery()
51
Class inherited from GlideRecord and performs the same functions as GlideRecord and enforces ACLs
GlideRecordSecure