GlideSystem Flashcards
The scoped GlideSystem (referred to by the variable name 'gs' in any server-side JavaScript) API provides a number of convenient methods to get information about the system, the current logged in user, etc. Many of the GlideSystem methods facilitate the easy inclusion of dates in query ranges, and are most often used in filters and reporting.
What does gs stand for?
GlideSystem
What type of information does gs give you access to?
Provides a number of convenient methods to get information about the system, the current logged in user, etc.
Many of the GlideSystem methods facilitate the easy inclusion of dates in query ranges, and are most often used in filters and reporting.
Adds an error message for the current session in Server Script
gs.addErrorMessage(String message)
Adds an info message for the current session in Server Script (This method is not supported for asynchronous business rules)
gs.addInfoMessage(String message)
Decodes a base64 string in Server Script
gs.base64Decode(String source)
Encodes into a base64 string in Server Script
gs.base64Encode(String source)
Returns the date and time for the beginning of last month in GMT in Server Script
gs.beginningOfLastMonth()
Returns the date and time for the beginning of last week in GMT in Server Script
gs.beginningOfLastWeek()
Returns the date and time for the beginning of next month in GMT in Server Script
gs.beginningOfNextMonth()
Returns the date and time for the beginning of next week in GMT in Server Script
gs.beginningOfNextWeek()
Returns the date and time for the beginning of next year in GMT in Server Script
gs.beginningOfNextYear()
Returns the date and time for the beginning of this month in GMT in Server Script
gs.beginningOfThisMonth()
Returns the date and time for the beginning of this quarter in GMT in Server Script
gs.beginningOfThisQuarter()
Returns the date and time for the beginning of this week in GMT in Server Script
gs.beginningOfThisWeek()
Returns the date and time for the beginning of this year in GMT in Server Script
gs.beginningOfThisYear()
Generates a date and time for the specified date in GMT in Server Script
gs.dateGenerate(String date, String range)
Returns the date and time for a specified number of days ago in Server Script
gs.daysAgo(Number days)
Returns the date and time for the end of the day a specified number of days ago in Server Script
gs.daysAgoEnd(Number days)
Returns the date and time for the beginning of the day a specified number of days ago in Server Script
gs.daysAgoStart(Number days)
Writes a debug message to the system log in Server Script
gs.debug(String message, Object parm1, Object parm2, Object parm3, Object parm4, Object parm5)
Returns the date and time for the end of last month in GMT in Server Script
gs.endOfLastMonth()
Returns the date and time for the end of last week in GMT in Server Script
gs.endOfLastWeek()
Returns the date and time for the end of last year in GMT in Server Script
gs.endOfLastYear()
Returns the date and time for the end of next month in GMT in Server Script
gs.endOfNextMonth()
Returns the date and time for the end of next week in GMT in Server Script
gs.endOfNextWeek()
Returns the date and time for the end of next year in GMT in Server Script
gs.endOfNextYear()
Returns the date and time for the end of this month in GMT in Server Script
gs.endOfThisMonth()
Returns the date and time for the end of this quarter in GMT in Server Script
gs.endOfThisQuarter()
Returns the date and time for the end of this week in GMT in Server Script
gs.endOfThisWeek()
Returns the date and time for the end of this year in GMT in Server Script
gs.endOfThisYear()
Writes an error message to the system log in Server Script
gs.error(String message, Object parm1, Object parm2, Object parm3, Object parm4, Object parm5)
Queues an event for the event manager in Server Script
eventQueue(String name, Object instance, String parm1, String parm2, String queue)
Queues an event in the event manager with event schedule in Server Script
gs.eventQueueScheduled(String name, Object instance, String parm1, String parm2, Object expiration)
Executes a job for a scoped application in Server Script
gs.executeNow(GlideRecord job)
Generates a GUID that can be used when a unique identifier is required in Server Script
gs.generateGUID()
Gets the caller scope name in Server Script; returns null if there is no caller
gs.getCallerScopeName()
Gets a string representing the cache version for a CSS file in Server Script
gs.getCssCacheVersionString()
When would you use this??
Gets the ID of the current application as set using the Application Picker in Server Script
gs.getCurrentApplicationId()
Gets the name of the current scope in Server Script
gs.getCurrentScopeName()
Returns the list of error messages for the session that were added by addErrorMessage() in Server Script
gs.getErrorMessages()
Retrieves the specified message from the Message [sys_ui_message] table in Server Script. If the message has HTML special characters, replaces them with the corresponding HTML name codes. For example, & becomes &.
gs.getEscapedMessage(String id, Array args)
Retrieves translated messages from the Message [sys_ui_message] table to display in a UI in Server Script
gs.getMessage(String id, Array args)
If the UI message has a tick (‘), there may be issues with the message in the script; to escape the ticks (‘). What would you use in Server Script?
gs.getMessageS(String, Object)
Gets the value of a Glide property in Server Script. If the property is not found, returns an alternate value.
gs.getProperty(String key, Object alt)
Gets a reference to the current Glide session in Server Script
gs.getSession()
Retrieves the GlideSession session ID in Server Script
gs.getSessionID()
Retrieves the GlideSession session token in Server Script
gs.getSession().getSessionToken()
Returns the name of the time zone associated with the current user in Server Script
gs.getSession().getTimeZoneName()
Gets the current URI for the session in Server Script
gs.getUrlOnStack()
Returns a reference to the scoped GlideUser object for the current user in Server Script
gs.getUser()
Gets the display name of the current user in Server Script
gs.getUserDisplayName()
Gets the sys_id of the current user in Server Script
gs.getUserID()
Gets the user name, or user id, of the current user in Server Script
gs.getUserName()
Determines if the current user has the specified role in Server Script
gs.hasRole(Object role)
Returns the date and time for a specified number of hours ago in Server Script
gs.hoursAgo(Number hours)
Returns the date and time for the end of the hour a specified number of hours ago in Server Script
gs.hoursAgoEnd(Number hours)
Returns the date and time for the start of the hour a specified number of hours ago in Server Script
gs.hoursAgoStart(Number hours)
Provides a safe way to call from the sandbox, allowing only the inclusion of trusted scripts in Server Script
gs.include(String name)
Writes an info message to the system log in Server Script
gs.info(String message, Object parm1, Object parm2, Object parm3, Object parm4, Object parm5)
Determines if debugging is active for a specific scoped in Server Script
gs.isDebugging()
Checks if the current session is interactive in Server Script.
An example of an interactive session is when a user logs in normally. An example of a non-interactive session is using a SOAP request to retrieve data.
gs.isInteractive()
Determines if the current user is currently logged-in in Server Script
gs.isLoggedIn()
Determines if a request comes from a mobile device in Server Script
gs.isMobile()
This method can be used in UI action conditions and business rules.
Returns the date and time for the end of the minute a specified number of minutes ago in Server Script
gs.minutesAgoEnd(Number minutes)
Returns the date and time for the start of the minute a specified number of minutes ago in Server Script
gs.minutesAgoStart(Number minutes)
Returns the date and time for a specified number of months ago in Server Script
gs.monthsAgo(Number months)
Returns the date and time for the start of the month a specified number of months ago in Server Script
gs.monthsAgoStart(Number months)
Queries an object and returns true if the object is null, undefined, or contains an empty string in Server Script
gs.nil(Object o)
Returns the date and time for the last day of the quarter for a specified number of quarters ago in Server Script
gs.quartersAgoEnd(Number quarters)
Returns the date and time for the first day of the quarter for a specified number of quarters ago in Server Script
gs.quartersAgoStart(Number quarters)
Sets the specified key to the specified value if the property is within the script’s scope in Server Script
gs.setProperty(String key, String value, String description)
Causes a system wide cache flush
Sets the redirect URI for this transaction, which then determines the next page the user will see in Server Script
gs.setRedirect(Object o)
Determines if a database table exists in Server Script
gs.tableExists(String name)
Replaces UTF-8 encoded characters with ASCII characters in Server Script
gs.urlDecode(String url)
Encodes non-ASCII characters, unsafe ASCII characters, and spaces so the returned string can be used on the Internet. Uses UTF-8 encoding. Uses percent (%) encoding in Server Script
gs.urlEncode(String url)
Writes a warning message to the system log in Server Script
gs.warn(String message, Object parm1, Object parm2, Object parm3, Object parm4, Object parm5)
Takes an XML string and returns a JSON object in Server Script
gs.xmlToJSON(String xmlString)
Returns a date and time for a certain number of years ago in Server Script
gs.yearsAgo(Number years)
Returns yesterday’s time (24 hours ago) in Server Script
gs.yesterday()