intelligen
Version:
Generate VS Code intellisense from Service Now Instance data
882 lines (881 loc) • 83.1 kB
Plain Text
/*
Copyright (C) 2019 ServiceNow, Inc. All rights reserved.
*/
/** The scoped GlideDate class provides methods for performing operations on GlideDate objects, such as instantiating GlideDate objects or working with GlideDate fields */
declare const GlideDate: GlideDate;
interface GlideDate {
new(): GlideDate_proto;
readonly prototype: GlideDate_proto;
}
interface GlideDate_proto {
/** Gets the duration difference between two GlideDate values */
subtract(start: GlideDate, end: GlideDate): GlideDuration;
/** Gets the date in the given date format */
getByFormat(format: string): string;
/** Gets the date in the current user's display format and time zone */
getDisplayValue(): string;
/** Gets the display value in the internal format (yyyy-MM-dd). Note: This method is useful for date or time fields, but not date fields */
getDisplayValueInternal(): string;
/** Gets the date value stored in the database by the GlideDate object in the internal format, yyyy-MM-dd, and the system time zone, UTC by default */
getValue(): string;
/** Sets a date value using the current user's display format and time zone */
setDisplayValue(asDisplayed: string): void;
/** Sets the date of the GlideDate object */
setValue(o: any): void;
/** Returns the day part of a date with no timezone conversion */
getDayOfMonthNoTZ(): number;
/** Returns the month part of a date with no timezone conversion */
getMonthNoTZ(): number;
/** Returns the year part of a date with no timezone conversion */
getYearNoTZ(): number;
}
/** The scoped GlideDateTime default constructor, instantiates a new GlideDateTime object with the current date and time in Greenwich Mean Time (GMT). Optional 'value' parameter with a date and time value in the UTC time zone specified with the format yyyy-MM-dd HH:mm:ss */
declare const GlideDateTime: GlideDateTime;
interface GlideDateTime {
new(): GlideDateTime_proto;
readonly prototype: GlideDateTime_proto;
}
interface GlideDateTime_proto {
/** Gets the date in the system time zone */
getDate(): GlideDate;
/** Gets the duration difference between two GlideDateTime values. Pass a single paramter which specifies milliseconds to subtract from the current GlideDateTime object */
subtract(start: GlideDateTime, end: GlideDateTime): GlideDuration;
/** Gets the date for the user's time zone */
getLocalDate(): GlideDate;
/** Returns a GlideTime object that represents the time portion of the GlideDateTime object in the user's time zone */
getLocalTime(): GlideTime;
/** Returns a GlideTime object that represents the time portion of the GlideDateTime object */
getTime(): GlideTime;
/** Adds a specified number of days to the current GlideDateTime object, expressed in the user's timezone */
addDaysLocalTime(amount: number): void;
/** Adds a specified number of days to the current GlideDateTime object, expressed in the UTC time zone */
addDaysUTC(amount: number): void;
/** Adds a specified number of months to the current GlideDateTime object, expressed in the user's time zone */
addMonthsLocalTime(amount: number): void;
/** Adds a specified number of months to the current GlideDateTime object, expressed in the UTC time zone */
addMonthsUTC(amount: number): void;
/** Adds a specified number of seconds to the current GlideDateTime object */
addSeconds(value: number): void;
/** Adds a specified number of weeks to the current GlideDateTime object, expressed in the user's timezone */
addWeeksLocalTime(amount: number): void;
/** Adds a specified number of weeks to the current GlideDateTime object, expressed in the UTC time zone */
addWeeksUTC(amount: number): void;
/** Adds a specified number of years to the current GlideDateTime object, expressed in the user's time zone */
addYearsLocalTime(amount: number): void;
/** Adds a specified number of years to the current GlideDateTime object, expressed in the UTC time zone */
addYearsUTC(amount: number): void;
/** Compares two GlideDateTime objects */
compareTo(Object: GlideDateTime): number;
equals(Object: GlideDateTime): boolean;
/** Gets the day of the month stored by the GlideDateTime object, expressed in the current user's time zone */
getDayOfMonthLocalTime(): number;
/** Gets the day of the month stored by the GlideDateTime object, expressed in the UTC time zone */
getDayOfMonthUTC(): number;
/** Gets the day of the week stored by the GlideDateTime object, expressed in the user's time zone */
getDayOfWeekLocalTime(): number;
/** Gets the day of the week stored by the GlideDateTime object, expressed in the UTC time zone */
getDayOfWeekUTC(): number;
/** Sets the day of the month to a specified value in the user's time zone */
getDaysInMonthLocalTime(): number;
/** Gets the number of days in the month stored by the GlideDateTime object, expressed in the UTC time zone */
getDaysInMonthUTC(): number;
/** Gets the datetime in the current user's display format and time zone */
getDisplayValue(): string;
/** Gets the display value in the internal datetime format */
getDisplayValueInternal(): string;
getDisplayValueWithoutTZ(): string;
/** Gets the amount of time that daylight savings time is offset */
getDSTOffset(): number;
/** Gets the current error message */
getErrorMsg(): string;
/** Gets the month stored by the GlideDateTime object, expressed in the current user's time zone */
getMonthLocalTime(): number;
/** Gets the month stored by the GlideDateTime object, expressed in the UTC time zone */
getMonthUTC(): number;
/** Gets the number of milliseconds since January 1, 1970, 00:00:00 Greenwich Mean Time (GMT) */
getNumericValue(): number;
getTZOffset(): number;
/** Gets a datetiime value in the same format as it is stored in the database */
getValue(): string;
/** Gets the number of the week stored by the GlideDateTime object, expressed in the user's time zone */
getWeekOfYearLocalTime(): number;
/** Gets the number of the current week of the current year */
getWeekOfYearUTC(): number;
/** Gets the year stored by the GlideDateTime object, expressed in the current user's time zone */
getYearLocalTime(): number;
/** Gets the year stored by the GlideDateTime object, expressed in the UTC time zone */
getYearUTC(): number;
/** Determines if an object's date is set */
hasDate(): boolean;
hashCode(): number;
/** Determines if an object's time uses a daylight savings offset */
isDST(): boolean;
/** Determines if a value is a valid datetime */
isValid(): boolean;
/** Sets the day of the month to a specified value in the local time zone */
setDayOfMonthLocalTime(day: number): void;
/** Sets the day of the month to a specified value in the UTC time zone */
setDayOfMonthUTC(day: number): void;
/** Sets a date and time value using the current user's display format and time zone. Also set an optional parameter 'format', to set date and time format */
setDisplayValue(value: string, format: string): void;
/** Sets a date and time value using the internal format and the current user's time zone */
setDisplayValueInternal(value: string): void;
/** Sets the month stored by the GlideDateTime object to a specified value using the current user's time zone */
setMonthLocalTime(month: number): void;
/** Sets the month stored by the GlideDateTime object to a specified value using the UTC time zone */
setMonthUTC(month: number): void;
/** Sets the date and time */
setValue(value: number): void;
/** Sets a date and time value using the UTC time zone and the specified date and time format */
setValueUTC(dt: string, format: string): void;
/** Sets the year stored by the GlideDateTime object to a specified value using the current user's time zone */
setYearLocalTime(year: number): void;
/** Sets the year stored by the GlideDateTime object to a specified value using the UTC time zone */
setYearUTC(year: number): void;
/** Sets the date and time of the current object using an existing GlideDateTime object. This method is equivalent to instantiating a new object with a GlideDateTime parameter */
setGlideDateTime(gdt: GlideDateTime): void;
/** Adds a GlideTime object to the current GlideDateTime object */
add(gt: GlideTime): void;
/** Converts a datetime value to a string */
toString(): string;
/** Returns local time with user time format */
getUserFormattedLocalTime(): string;
/** Returns local time with internal time format */
getInternalFormattedLocalTime(): string;
/** Returns true if the object's data time is after the input argument */
after(Object: GlideDateTime): boolean;
/** Returns true if the object's data time is before the input argument */
before(Object: GlideDateTime): boolean;
/** Returns true if the object's data time is on or after the input argument */
onOrAfter(Object: GlideDateTime): boolean;
/** Returns true if the object's data time is on or before the input argument */
onOrBefore(Object: GlideDateTime): boolean;
}
/** The scoped GlideDuration class provides methods for working with spans of time or durations. GlideDuration objects store the duration as a date and time from January 1, 1970, 00:00:00. As a result, setValue() and getValue() use the GlideDateTime object for parameters and return values */
declare const GlideDuration: GlideDuration;
interface GlideDuration {
new(): GlideDuration_proto;
readonly prototype: GlideDuration_proto;
}
interface GlideDuration_proto {
/** Adds a given duration to the current duration */
add(value: GlideDuration): GlideDuration;
subtract(value: GlideDuration): GlideDuration;
/** Gets the current duration in the given format */
getByFormat(format: string): string;
/** Gets the number of days */
getDayPart(): number;
/** Gets the display value of the duration in number of days, hours, and minutes */
getDisplayValue(): string;
/** Gets the duration value in d HH:mm:ss format */
getDurationValue(): string;
/** Gets the rounded number of days. If the time part is more than 12 hours, the return value is rounded up. Otherwise, it is rounded down */
getRoundedDayPart(): number;
/** Gets internal value of the this duration object. GlidDuration is stored as DateTime */
getValue(): string;
/** Sets the display value */
setDisplayValue(asDisplayed: string): void;
/** Sets the internal value of the GlideDuration object. Internally, GlidDuration is stored as DateTime */
setValue(o: any): void;
}
/** The scoped GlideTime class provides methods for performing operations on GlideTime objects, such as instantiating GlideTime objects or working with GlideTime fields */
declare const GlideTime: GlideTime;
interface GlideTime {
new(): GlideTime_proto;
readonly prototype: GlideTime_proto;
}
interface GlideTime_proto {
/** Gets the duration difference between two GlideTime values */
subtract(start: GlideTime, end: GlideTime): GlideDuration;
/** Gets the time in the given time format */
getByFormat(format: string): string;
/** Gets the time in the current user's display format and time zone */
getDisplayValue(): string;
/** Gets the display value in the current user's time zone and the internal format (HH:mm:ss). Useful for date/time fields, but not for date fields */
getDisplayValueInternal(): string;
/** Gets the time value stored in the database by the GlideTime object in the internal format, HH:mm:ss, and the system time zone, UTC by default */
getValue(): string;
/** Sets a time value using the current user's display format and time zone */
setDisplayValue(asDisplayed: string): void;
/** Sets the time of the GlideTime object in the internal time zone, which is UTC by default or the value of the glide.sys.internal.tz property, if set */
setValue(value: any): void;
/** Returns the hour-of-the-day part of UTC time 0-23 */
getHourOfDayUTC(): number;
/** Returns hour part of UTC time 0-11 */
getHourUTC(): number;
/** Returns minutes part of UTC time */
getMinutesUTC(): number;
/** Returns hour-of-the-day part of local time 0-23 */
getHourOfDayLocalTime(): number;
/** Returns hour part of local time 0-11 */
getHourLocalTime(): number;
/** Returns minutes part of local time */
getMinutesLocalTime(): number;
/** Returns seconds part of time */
getSeconds(): number;
}
/** The scoped GlideSchedule API provides methods for performing operations on GlideSchedule objects, such as adding new schedule segments to a schedule, determining if a datetime is within the schedule, or setting the schedule timezone */
declare const GlideSchedule: GlideSchedule;
interface GlideSchedule {
new(): GlideSchedule_proto;
readonly prototype: GlideSchedule_proto;
}
interface GlideSchedule_proto {
/** Adds a new schedule segment to the current schedule */
add(startDate: GlideDateTime, offset: GlideDuration): GlideDateTime;
/** Determines the elapsed time in the schedule between two date time values using the timezone of the schedule or, if that is not specified, the timezone of the session */
duration(startDate: GlideDateTime, endDate: GlideDateTime): GlideDuration;
/** Determines if the current schedule is valid. A schedule is valid if it has at least one schedule span */
isValid(): boolean;
/** Gets the current schedule name */
getName(): string;
/** Loads a schedule with the schedule information. If a timezone is not specified or is nil, the current session timezone is used for the schedule */
load(sysID: string, timeZone: string, excludeSpanID: string): void;
/** Sets the timezone for the current schedule */
setTimeZone(tz: string): void;
}
/** The Scoped GlideUser API provides access to information about the current user and current user roles. Using the Scoped GlideUser API avoids the need to use the slower GlideRecord queries to get user information */
declare const GlideUser: GlideUser;
interface GlideUser {
new(): GlideUser_proto;
readonly prototype: GlideUser_proto;
}
interface GlideUser_proto {
/** Gets the sys_id of current user */
getID(): string;
/** Gets the user id, or login name, of the current user */
getName(): string;
/** Gets the display name of the current user */
getDisplayName(): string;
/** Gets the Company ID of the current user */
getCompanyID(): string;
/** Determines if the current user is a member of the specified group */
isMemberOf(group: string): boolean;
/** Determines if the current user has the specified role */
hasRole(role: string): boolean;
/** Saves a user preference value to the database */
savePreference(name: string, value: string): void;
/** Gets the specified user preference value for the current user */
getPreference(name: string): string;
}
/** GlideSession manages all of the information for a user session. You can retrieve this from gs.getSession() */
declare const GlideSession: GlideSession;
interface GlideSession {
new(): GlideSession_proto;
readonly prototype: GlideSession_proto;
}
interface GlideSession_proto {
/** Checks if the current session is interactive */
isInteractive(): boolean;
/** Determines if the current user is currently logged in */
isLoggedIn(): boolean;
/** Get the Time Zone name associated with the user */
getTimeZoneName(): string;
/** Language used by the user */
getLanguage(): string;
/** Gets the current URI for the session */
getUrlOnStack(): string;
/** Gets the ID of current application, defined as a user preference and set by the application picker */
getCurrentApplicationId(): string;
/** Gets the client IP address */
getClientIP(): string;
/** Fetch the value in active session based on the name */
getClientData(name: string): string;
/** Store a value in an active session */
putClientData(name: string, value: string): void;
}
/** The scoped GlideAggregate class is an extension of GlideRecord and allows database aggregation (COUNT, SUM, MIN, MAX, AVG) queries to be done. This can be helpful in creating customized reports or in calculations for calculated fields. The GlideAggregate class works only on number fields. Since currency fields are strings, you can't use the GlideAggregate class on currency fields */
declare const GlideAggregate: GlideAggregate;
interface GlideAggregate {
new(): GlideAggregate_proto;
readonly prototype: GlideAggregate_proto;
}
interface GlideAggregate_proto {
/** Adds a query to the aggregate */
addQuery(field: string, operator: string, value: string): GlideQueryCondition;
/** Adds a NULL query to the aggregate */
addNullQuery(field: string): GlideQueryCondition;
/** Adds a NOT NULL query to the aggregate */
addNotNullQuery(field: string): GlideQueryCondition;
/** Issues the query and gets the results */
query(): void;
/** Adds an aggregate */
addAggregate(aggregate: string, field: string): void;
/** Gets the value of the specified aggregate */
getAggregate(aggregate: string, field: string): string;
/** Retrieves the number of rows in the GlideRecord */
getRowCount(): number;
/** Retrieves the table name associated with this GlideRecord */
getTableName(): string;
/** Gets the value of a field */
getValue(field: string): string;
/** Retrieves the encoded query */
getEncodedQuery(): string;
/** Adds a query to the aggregate. Adds an encoded query to the other queries that may have been set for this aggregate */
addEncodedQuery(query: string): void;
/** Gets the query necessary to return the current aggregate */
getAggregateEncodedQuery(): string;
/** Provides the name of a field to use in grouping the aggregates. May be called numerous times to set multiple group fields */
groupBy(field: string): void;
/** Orders the aggregates using the value of the specified field. The field will also be added to the group-by list */
orderBy(field: string): void;
/** Sorts the aggregates into descending order based on the specified field */
orderByDesc(field: string): void;
/** Sorts the aggregates based on the specified aggregate and field */
orderByAggregate(aggregate: string, field: string): void;
/** Moves to the next record in the GlideAggregate */
next(): boolean;
/** Determines if there are any more results in the GlideAggregate */
hasNext(): boolean;
/** Sets whether the results are to be grouped */
setGroup(value: boolean): void;
}
/** The Scoped GlideElement API provides methods for dealing with fields and their values. Scoped GlideElement methods are available for the fields of the current GlideRecord */
declare const GlideElement: GlideElement;
interface GlideElement {
new(): GlideElement_proto;
readonly prototype: GlideElement_proto;
}
interface GlideElement_proto {
/** Retrieves the choice list for a field */
getChoices(dependent: string): [];
/** Sets the display value of the field */
setDisplayValue(value: any): void;
/** Sets the display value of the field */
setValue(value: any): void;
/** Gets a GlideRecord object for a reference element */
getRefRecord(): GlideRecord;
/** Converts the value to a string */
toString(): string;
/** Gets the field's element descriptor */
getED(): GlideElementDescriptor;
/** Gets the decrypted value */
getDecryptedValue(): string;
/** Gets the formatted display value of the field */
getDisplayValue(maxCharacters: number): string;
/** Determines whether the field is null */
nil(): boolean;
/** Determines if the current field has been modified */
changes(): boolean;
/** Gets the object's label */
getLabel(): string;
/** Gets the name of the field */
getName(): string;
/** Gets the table name */
getTableName(): string;
/** Determines if the user's role permits creation of new records in this field */
canCreate(): boolean;
/** Determines if the GlideRecord table can be read from */
canRead(): boolean;
/** Determines if the GlideRecord table can be written to */
canWrite(): boolean;
/** Gets the value of the attribute on the field in question from the dictionary as a string. If the attribute is a boolean attribute, use getBooleanAttribute(String) to get the value as a boolean rather than as a string */
getAttribute(attribute: string): string;
/** Gets the value of the attribute on the field in question from the dictionary as a string. To get the value as a string, use getAttribute(string) */
getBooleanAttribute(attribute: string): boolean;
/** Determines whether a field has a particular attribute */
hasAttribute(attribute: string): boolean;
/** Adds an error message. Can be retrieved using getError() */
setError(message: string): void;
/** Gets table name for a reference field */
getReferenceTable(): string;
/** Determines if the new value of a field after a change matches a certain object */
changesTo(value: any): boolean;
/** Determines the previous value of the current field matched a certain object */
changesFrom(value: any): boolean;
/** Gets the currency ISO code for a record */
getCurrencyCode(): string;
/** Gets the currency display value */
getCurrencyDisplayValue(): string;
/** Gets currency in a string */
getCurrencyString(): string;
/** Gets a currency value */
getCurrencyValue(): string;
/** The currency ISO code, in the base system currency */
getReferenceCurrencyCode(): string;
/** Gets the display value */
getReferenceDisplayValue(): string;
/** Gets the reference value */
getReferenceValue(): string;
/** Gets the sessions currency ISO code */
getSessionCurrencyCode(): string;
/** Gets the currency value in the sessions currency format */
getSessionDisplayValue(): string;
/** Gets the ammount in the sessions currency */
getSessionValue(): string;
/** Sets a date to a numeric value */
setDateNumericValue(value: any): void;
/** Gets date in numberic value */
dateNumericValue(value: string): number;
}
/** The scoped GlideElementDescriptor class provides information about individual fields */
declare const GlideElementDescriptor: GlideElementDescriptor;
interface GlideElementDescriptor {
new(): GlideElementDescriptor_proto;
readonly prototype: GlideElementDescriptor_proto;
}
interface GlideElementDescriptor_proto {
/** Returns the field's name */
getName(): string;
/** Returns the field's data type */
getInternalType(): string;
/** Returns the field's label */
getLabel(): string;
/** Returns the field's length */
getLength(): number;
}
/** Scoped GlideRecord is used for database operations instead of writing SQL queries. Provides data access APIs to retrieve, update, and delete records from a table */
declare var GlideRecord: GlideRecord;
interface GlideRecord {
new(): GlideRecord_proto;
readonly prototype: GlideRecord_proto;
}
interface GlideRecord_proto {
/** Insert a new record using the field values that have been set for the current record */
insert(): string;
/** Runs the query against the table based on the specified filters by addQuery and addEncodedQuery */
query(): void;
/** Defines a GlideRecord based on the specified expression of name = value */
get(name: any, value: any): boolean;
/** Updates the current GlideRecord with any changes that have been made */
update(reason: any): string;
/** Updates each GlideRecord in the list with any changes that have been made */
updateMultiple(): void;
/** Deletes the current record */
deleteRecord(): boolean;
/** Deletes records that satisfy current query condition */
deleteMultiple(): void;
/** Sets the value for the specified field. */
setValue(fieldName: string, value: any): void;
/** Sets a flag to indicate if the next database action (insert, update, delete) is to be aborted */
setAbortAction(b: boolean): void;
/** Enables and disables the running of business rules and script engines. When disabled, inserts and updates are not audited */
setWorkflow(e: boolean): void;
/** Adds a filter to return records by specifying a field and value. You can use an optional 'operator' as a second parameter */
addQuery(name: string, value: string): GlideQueryCondition;
/** Adds a filter to return active records */
addActiveQuery(): GlideQueryCondition;
/** Adds a filter to return records where the specified field is null */
addNullQuery(fieldName: string): GlideQueryCondition;
/** Adds a filter to return records where the specified field is not null */
addNotNullQuery(fieldName: string): GlideQueryCondition;
/** Adds a filter to return records based on a relationship in a related table */
addJoinQuery(joinTable: string, primaryField: any, joinTableField: any): GlideQueryCondition;
/** Retrieves the GlideElement for a specified field */
getElement(fieldName: string): GlideElement;
/** Retrieves the number of rows in the GlideRecord */
getRowCount(): number;
/** Retrieves the table name associated with this GlideRecord */
getTableName(): string;
/** Retrieves the class name for the current record */
getRecordClassName(): string;
/** Retrieves the query condition of the current result set as an encoded query string */
getEncodedQuery(): string;
/** Adds an encoded query to the other queries that may have been set */
addEncodedQuery(query: string): void;
/** Moves to the next record in the GlideRecord */
next(): boolean;
/** Determines if there are any more records in the GlideRecord */
hasNext(): boolean;
/** Retrieves the underlying value of a field */
getValue(fieldName: string): string;
/** Gets the primary key of the record, which is usually the sys_id unless otherwise specified */
getUniqueValue(): string;
/** Retrieves the name of the display field */
getDisplayName(): string;
/** Retrieves the display value for the current record */
getDisplayValue(fieldName: string): string;
getClassDisplayValue(): string;
/** The label of the field as a String */
getLabel(): string;
/** Determines if current record is a valid record */
isValidRecord(): boolean;
/** Determines if the given field is defined in the current table */
isValidField(fieldName: string): boolean;
/** Creates an empty record suitable for population before an insert */
initialize(): void;
/** Creates a new GlideRecord, sets the default values for the fields, and assigns a unique ID to the record */
newRecord(): void;
/** Checks if the current record is a new record that has not yet been inserted into the database */
isNewRecord(): boolean;
/** Determines whether the table exists or not */
isValid(): boolean;
/** Retrieves the current operation being performed, such as insert, update, or delete */
operation(): string;
/** Specifies an orderBy column */
orderBy(fieldName: string): void;
/** Specifies a descending orderBy */
orderByDesc(fieldName: string): void;
/** Sets the maximum number of records in the GlideRecord to be fetched in the next query */
setLimit(limit: number): void;
/** Sets a range of rows to be returned by subsequent queries. If forceCount is true, getRowCount() method will return all possible records */
chooseWindow(firstRow: number, lastRow: number, forceCount: boolean): void;
/** Determines if the Access Control Rules which include the user's roles permit inserting new records in this table */
canCreate(): boolean;
/** Determines if the Access Control Rules which include the user's roles permit deleting records in this table */
canDelete(): boolean;
/** Determines if the Access Control Rules which include the user's roles permit reading records in this table */
canRead(): boolean;
/** Determines if the Access Control Rules which include the user's roles permit editing records in this table */
canWrite(): boolean;
/** Sets sys_id value for the current record */
setNewGuidValue(guid: string): void;
/** Retrieves a link to the current record */
getLink(nostack: boolean): string;
/** Retrieves the last error message */
getLastErrorMessage(): string;
/** Gets the attributes on the field in question from the dictionary */
getAttribute(attribute: string): string;
getCategory(): string;
setCategory(category: string): void;
autoSysFields(b: boolean): void;
/** Determines whether the current database action is to be aborted. Available in Fuji patch 3 */
isActionAborted(): boolean;
/** Retrieve the specified platform function in addition of the field values */
addFunction(functionDefinition: string): void;
}
/** GlideRecordSecure is a class inherited from GlideRecord that performs the same functions as GlideRecord, and also enforces ACLs */
declare const GlideRecordSecure: GlideRecordSecure;
interface GlideRecordSecure extends GlideRecord {
}
/** The scoped QueryCondition API provides additional AND or OR conditions that can be added to the current condition, allowing you to build complex queries such as: category='hardware' OR category='software' AND priority='2' AND priority='1' */
declare const GlideQueryCondition: GlideQueryCondition;
interface GlideQueryCondition {
new(): GlideQueryCondition_proto;
readonly prototype: GlideQueryCondition_proto;
}
interface GlideQueryCondition_proto {
/** Adds an OR condition to the current condition. oper is an optional parameter */
addOrCondition(name: string, oper: string, value: any): GlideQueryCondition;
/** Adds an AND condition to the current condition. oper is an optional parameter */
addCondition(name: string, oper: string, value: any): GlideQueryCondition;
}
/** The API allows you to evaluate scripts from a GlideRecord field */
declare const GlideScopedEvaluator: GlideScopedEvaluator;
interface GlideScopedEvaluator {
new(): GlideScopedEvaluator_proto;
readonly prototype: GlideScopedEvaluator_proto;
}
interface GlideScopedEvaluator_proto {
/** Evaluates a script from a GlideRecord field. variables parameter is optional */
evaluateScript(gr: GlideRecord, scriptField: string, variables: any): any;
/** Puts a variable into the GlideScopedEvaluator object */
putVariable(name: string, value: any): void;
/** Gets a variable from a GlideScopedEvaluator object */
getVariable(name: string): any;
}
/** A wrapper around an InputStream. No functions are provided to manipulate the stream from script. Rather this object can be passed to any API which takes an InputStream as an input parameter */
declare const GlideScriptableInputStream: GlideScriptableInputStream;
interface GlideScriptableInputStream {
}
/** ServiceNow processors are equivalent to Java servlets. Processors provide a customizable URL endpoint that can execute arbitrary server-side Javascript code and produce output such as TEXT, JSON, or HTML. The GlideScriptedProcessor APIs are used in processor scripts to access the the processor (servlet) capabilities. There are no constructors for the GlideScriptedProcessor APIs. The methods are called using the global variable g_processor. A useful global variable, g_target, is available in processor scripts. It contains the table name extracted from the URL. The URL to a processor has the format: https://<instance name.servicenow.com>/<path endpoint>.do?<parameter endpoint>=<value> where the path endpoint and parameter endpoint are defined on the processor form */
declare const GlideScriptedProcessor: GlideScriptedProcessor;
interface GlideScriptedProcessor {
new(): GlideScriptedProcessor_proto;
readonly prototype: GlideScriptedProcessor_proto;
}
interface GlideScriptedProcessor_proto {
/** Redirects to the specified URL */
redirect(url: string): void;
/** Writes the contents of the given string to the response */
writeOutput(contentType: string, value: string): void;
/** Writes a JSON object to the current URL. Note: Works only in scoped apps */
writeJSON(jsonObject: any): void;
}
/** ServiceNow processors are equivalent to Java servlets. Processors provide a customizable URL endpoint that can execute arbitrary server-side Javascript code and produce output such as TEXT, JSON, or HTML. The GlideServletRequest API is used in processor scripts to access the HttpServletRequest object. The GlideServletRequest object provides a subset of the HttpServletRequest APIs. The methods are called using the global variable g_request. A useful global variable, g_target, is available in processor scripts. It contains the table name extracted from the URL. The URL to a processor has the format: https://<instance name.servicenow.com>/<path endpoint>.do?<parameter endpoint>=<value> where the path endpoint and parameter endpoint are defined on the processor form */
declare const GlideServletRequest: GlideServletRequest;
interface GlideServletRequest {
new(): GlideServletRequest_proto;
readonly prototype: GlideServletRequest_proto;
}
interface GlideServletRequest_proto {
/** Returns the content type */
getContentType(): string;
/** Returns the header */
getHeader(name: string): string;
/** Returns an array of headers as a string */
getHeaders(name: string): string[];
/** Returns an array of header names as a string */
getHeaderNames(): string[];
/** Returns an object */
getParameter(name: string): any;
/** Returns an array of parameter names as a string */
getParameterNames(): string[];
/** Returns the query string from the request */
getQueryString(): string;
}
/** ServiceNow processors are equivalent to Java servlets. Processors provide a customizable URL endpoint that can execute arbitrary server-side Javascript code and produce output such as TEXT, JSON, or HTML. The GlideServletResponse API is used in processor scripts to access the HttpServletResponse object. The GlideServletResponse object provides a subset of the HttpServletResponse APIs. The methods are called using the global variable g_response. A useful global variable, g_target, is available in processor scripts. It contains the table name extracted from the URL. The URL to a processor has the format: https://<instance name.servicenow.com>/<path endpoint>.do?<parameter endpoint>=<value> where the path endpoint and parameter endpoint are defined on the processor form */
declare const GlideServletResponse: GlideServletResponse;
interface GlideServletResponse {
new(): GlideServletResponse_proto;
readonly prototype: GlideServletResponse_proto;
}
interface GlideServletResponse_proto {
/** Sends a temporary redirect to the client */
sendRedirect(location: string): void;
/** Sets the MIME type of the response */
setContentType(type: string): void;
/** Sets the status code for the response */
setStatus(status: number): void;
/** Sets a response header to the specified value */
setHeader(key: string, value: string): void;
}
/** The scoped GlideFilter class allows you to determine if a record meets a specified set of requirements. There is no constructor for scoped GlideFilter, it is accessed by using the global object 'GlideFilter' */
declare const GlideFilter: GlideFilter;
interface GlideFilter {
/** Returns true when the record meets the filter condition */
checkRecord(gr: GlideRecord, filter: string, value: boolean): boolean;
}
/** GlideLocale is a global object that can be called in scripts. Use the get() method to get a GlideLocale object */
declare const GlideLocale: GlideLocale;
interface GlideLocale {
new(): GlideLocale_proto;
readonly prototype: GlideLocale_proto;
/** Returns the GlideLocale object */
get(): GlideLocale;
}
interface GlideLocale_proto {
/** Returns the grouping separator */
getDecimalSeparator(): string;
/** Returns the decimal separator */
getGroupingSeparator(): string;
}
/** Scoped API for PluginManager */
declare const GlidePluginManager: GlidePluginManager;
interface GlidePluginManager {
new(): GlidePluginManager_proto;
readonly prototype: GlidePluginManager_proto;
}
interface GlidePluginManager_proto {
/** Determine if a plugin is activated */
isActive(pluginID: string): boolean;
}
/** The Scoped GlideTableHierarchy API provides methods for handling information about table relationships */
declare const GlideTableHierarchy: GlideTableHierarchy;
interface GlideTableHierarchy {
new(): GlideTableHierarchy_proto;
readonly prototype: GlideTableHierarchy_proto;
}
interface GlideTableHierarchy_proto {
/** Returns the table's name */
getName(): string;
/** Returns a list of the table names in the hierarchy */
getTables(): [];
/** Returns a list of all tables that extend the current table */
getTableExtensions(): [];
/** Returns a list of all tables that extend the current table and includes the current table */
getAllExtensions(): [];
/** Returns a list of all classes in the hierarchy of the given table */
getHierarchy(): [];
/** Returns the top level class in the hierarchy */
getRoot(): string;
/** Returns the parent class */
getBase(): string;
/** Returns true if this is a base class */
isBaseClass(): boolean;
/** Returns true if this table is not in a hierarchy */
isSoloClass(): boolean;
/** Returns true of this class has been extended */
hasExtensions(): boolean;
}
/** The Scoped GlideDBFunctionBuilder provides a builder API for creating platform function definition */
declare const GlideDBFunctionBuilder: GlideDBFunctionBuilder;
interface GlideDBFunctionBuilder {
new(): GlideDBFunctionBuilder_proto;
readonly prototype: GlideDBFunctionBuilder_proto;
}
interface GlideDBFunctionBuilder_proto {
/** Add a field parameter to the current function */
field(fieldName: string): GlideDBFunctionBuilder;
/** Add a constant parameter to the current function */
constant(constant: string): GlideDBFunctionBuilder;
/** End the current function */
endfunc(): GlideDBFunctionBuilder;
/** Return the completed function definition */
build(): string;
/** Start a length function */
length(): GlideDBFunctionBuilder;
/** Start a concatenation function */
concat(): GlideDBFunctionBuilder;
/** Start an addition function */
add(): GlideDBFunctionBuilder;
/** Start a subtraction function */
subtract(): GlideDBFunctionBuilder;
/** Start a multiplication function */
multiply(): GlideDBFunctionBuilder;
/** Start a division function */
divide(): GlideDBFunctionBuilder;
/** Start a function that return the duration between 2 dates */
datediff(): GlideDBFunctionBuilder;
/** Start a function that returns the day of the week of a given date */
dayofweek(): GlideDBFunctionBuilder;
/** Start a function that returns the current timestamp in the UTC timezone. This function should be used as a parameter to the datediff function to calculate a duration between the current datetime and another datetime field or datetime constant */
now(): GlideDBFunctionBuilder;
}
/** XMLDocument2 is a JavaScript Object wrapper for parsing and extracting XML data from an XML string. Use this JavaScript class to instantiate an object from an XML string, usually a return value from a Web Service invocation, or the XML payload of ECC Queue */
declare const XMLDocument2: XMLDocument2;
interface XMLDocument2 {
new(): XMLDocument2_proto;
readonly prototype: XMLDocument2_proto;
}
interface XMLDocument2_proto {
/** Gets the node specified in the xpath */
getNode(xpath: string): XMLNode;
/** Gets the first node in the specified xpath */
getFirstNode(xpath: string): XMLNode;
/** Gets the node after the specified node */
getNextNode(prev: XMLNode): XMLNode;
/** Creates and adds an element node to the current node. The element name is the string passed in as a parameter. The new element node has no text child nodes */
createElement(name: string): XMLNode;
/** Creates an element node with a text child node and adds it to the current node */
createElementWithTextValue(name: string, value: string): XMLNode;
/** Makes the node passed in as a parameter the current node */
setCurrentElement(element: XMLNode): void;
/** Gets the document element node of the XMLDocument2. The document element node is the root node */
getDocumentElement(): XMLNode;
/** Parses the XML string and loads it into the XMLDocument2 object */
parseXML(xmlDoc: string): boolean;
/** Gets all the text child nodes from the node referenced in the xpath */
getNodeText(xpath: string): string;
/** Checks if the XMLDocument is valid */
isValid(): boolean;
/** Returns a string containing the XML */
toString(): string;
}
/** The scoped XMLNode API allows you to query values from XML nodes. XMLNodes are extracted from XMLDocument2 objects, which contain XML strings */
declare const XMLNode: XMLNode;
interface XMLNode {
new(): XMLNode_proto;
readonly prototype: XMLNode_proto;
}
interface XMLNode_proto {
/** Gets the node's last child node */
getLastChild(): XMLNode;
/** Gets the node's first child node */
getFirstChild(): XMLNode;
/** Gets the node's XMLNodeIterator object */
getChildNodeIterator(): XMLNodeIterator;
/** Gets the node's text content */
getTextContent(): string;
/** Gets the node's value */
getNodeValue(): string;
/** Gets the node's name */
getNodeName(): string;
/** Determines if the node has the specified attribute */
hasAttribute(attribute: string): boolean;
/** Gets the value of the specified attribute */
getAttribute(attribute: string): string;
setAttribute(attribute: string, value: string): void;
appendChild(newChild: XMLNode): void;
/** Gets the node's string value */
toString(): string;
}
/** The scoped XMLNodeIterator class allows you to iterate through a node of a XML document */
declare const XMLNodeIterator: XMLNodeIterator;
interface XMLNodeIterator {
new(): XMLNodeIterator_proto;
readonly prototype: XMLNodeIterator_proto;
}
interface XMLNodeIterator_proto {
/** Gets the next element in the iteration */
next(): XMLNode;
/** Determines if the iteration has more elements */
hasNext(): boolean;
}
/** 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. */
declare const gs: gs;
interface gs {
/** Returns a reference to the GlideUser object for the current user */
getUser(): GlideUser;
/** Gets a reference to the current Glide session */
getSession(): GlideSession;
/** Queues an event for the event manager */
eventQueue(name: string, record: GlideRecord, parm1: string, parm2: string, queue: string): void;
/** Retrieves a message from UI messages */
getProperty(key: string, alt: Object): string;
urlDecode(url: string): string;
urlEncode(url: string): string;
base64Decode(s: string): string;
base64Encode(s: string): string;
xmlToJSON(xmlString: string): Object;
/** Gets the name of the current scope */
getCurrentScopeName(): string;
/** Gets the caller scope name, or returns null if there is no caller */
getCallerScopeName(): string;
/** Queries an object and returns true if the object is null, undefined, or contains an empty string */
nil(o: Object): boolean;
/** Retrieves a message from UI messages. args is an optional paramter */
getMessage(id: string, args: any): string;
/** Determines if the current user has the specified role */
hasRole(role: string): boolean;
/** Provides a safe way to call from the sandbox, allowing only trusted scripts to be included */
include(name: string): boolean;
/** Gets the GlideSession Session ID */
getSessionID(): string;
/** Determines if a database table exists */
tableExists(name: string): boolean;
/** Gets a string representing the cache version for a CSS file */
getCssCacheVersionString(): string;
/** Generates a GUID that can be used when a unique identifier is required */
generateGUID(obj: Object): string;
getNewAppScopeCompanyPrefix(): string;
getMaxSchemaNameLength(): number;
/** Adds an error message for the current session */
addErrorMessage(message: string): void;
/** Adds an info message for the current session */
addInfoMessage(message: string): void;
/** Gets the display name of the current user (e.g., Abel Tuter, as opposed to abel.tuter) */
getUserDisplayName(): string;
/** Gets the sys_id of the current user */
getUserID(): string;
/** Gets the username, or User ID, of the current user (e.g., abel.tuter) */
getUserName(): string;
/** Set the redirect URI for this transaction. This determines the next page the user will see */
setRedirect(url: string): void;
/** Checks if the current session is interactive */
isInteractive(): boolean;
/** Determines if the current user is currently logged in */
isLoggedIn(): boolean;
/** Gets the current URI for the session */
getUrlOnStack(): string;
/** Gets the ID of current application, defined as a user preference and set by the application picker */
getCurrentApplicationId(): string;
/** Returns (UTC) 24 hours ago adjusted for the timezone of the current session */
yesterday(): string;
/** Returns the (UTC) start of the day that was the specified number of days ago adjusted for the timezone of the server */
daysAgo(days: number): string;
/** Returns the (UTC) start of the day that was the specified number of days ago adjusted for the timezone of the server */
daysAgoStart(daysAgo: number): string;
/** Returns the (UTC) end of the day that was the specified number of days ago adjusted for the timezone of the server */
daysAgoEnd(daysAgo: number): string;
/** Returns the (UTC) beginning of the specified week adjusted for the timezone of the current session */
beginningOfWeek(o: Object): string;
/** Returns the (UTC) end of the specified week adjusted for the timezone of the current session */
endOfWeek(o: Object): string;
/** Returns the (UTC) end of next week adjusted for the timezone of the server */
endOfNextWeek(): string;
/** Gets the date and time for the beginning of next week in UTC, adjusted for the timezone of the server */
beginningOfNextWeek(): string;
/** Returns the (UTC) end of last week adjusted for the timezone of the server */
endOfLastWeek(): string;
/** Gets the date and time for the beginning of last week in UTC, adjusted for the timezone of the server */
beginningOfLastWeek(): string;
/** Gets the date and time for the beginning of this week in UTC, adjusted for the timezone of the server */
beginningOfThisWeek(): string;
/** Gets the date and time for the end of this week in UTC, adjusted for the timezone of the server */
endOfThisWeek(): string;
/** Gets the date and time for the beginning of this month in UTC, adjusted for the timezone of the server */
beginningOfThisMonth(): string;
/** Gets the date and time for the end of this month in UTC, adjusted for the timezone of the server */
endOfThisMonth(): string;
/** Gets the date and time for the beginning of next month in UTC, adjusted for the timezone of the server */
beginningOfNextMonth(): string;
/** Gets the date and time for the end of next month in UTC, adjusted for the timezone of the server */
endOfNextMonth(): string;
/** Gets the date and time for the beginning of last month in UTC, adjusted for the timezone of the server */
beginningOfLastMonth(): string;
/** Gets the date and time for the end of last month in UTC, adjusted for the timezone of the server */
endOfLastMonth(): string;
/** Returns the (UTC) start of the quarter that was the specified number of months ago adjusted for the timezone of the server */
monthsAgo(month: number): string;
/** Returns the (UTC) start of the quarter that was the specified number of months ago adjusted for the timezone of t