/* Copyright (C) 2019 ServiceNow, Inc. All rights reserved. */ /** Navigation API. Note: The code in this file is compatible with API Level 1 and API Level 2 */ declare const g_navigation: g_navigation; interface g_navigation { /** Redirects to another URL. \nurl: URL to be loaded. It can be any URL supported by the browser \ntarget: is the target frame. If left blank, the URL will load in the current frame */ open(url: string, target: string): void; /** Open a popup window with features \nurl: The url to open \nname: The name of the new window \nfeatures: is a comma separated list of features. See https://developer.mozilla.org/en-US/docs/Web/API/Window/open \nnoStack: True to append sysparm_stack=no to the url. This prevents weirdness when using the form back button \nreturns the instance of newly opened Window */ openPopup(url: string, name: string, features: string, noStack: boolean): any; /** Redirects to a record */ openRecord(table: string, sys_id: string): void; /** Reload the current frame */ reloadWindow(): void; /** Refresh the navigator contents */ refreshNavigator(): void; } /** g_form is a global object used in client-side scripts to customize forms */ declare const g_form: g_form; interface g_form { /** Adds an icon on a field’s label. This method is available starting with the Fuji release */ addDecoration(fieldName: string, icon: string, title: string): void; /** Displays an error message at the top of the form */ addErrorMessage(message: string): void; /** Displays an informational message at the top of the form */ addInfoMessage(message: string): void; /** Adds a choice to a choice list field If the index is not specified, the choice is added to the end of the list. Optional: Use the index field to specify a particular place in the list */ addOption(fieldName: string, choiceValue: string, choiceLabel: string): void; /** Removes messages that were previously added with addErrorMessage() and addInfoMessage() */ clearMessages(): void; /** Removes all options from a choice list */ clearOptions(fieldName: string): void; /** Removes any value(s) from the specified field */ clearValue(fieldName: string): void; /** Prevents new file attachments from being added Hides the paperclip icon. See also: enableAttachments() */ disableAttachments(): void; /** Allows new file attachments to be added Shows the paperclip icon. See also: disableAttachments() */ enableAttachments(): void; /** Flashes the specified color the specified number of times in the field. Used to draw attention to a particular field */ flash(widgetName: string, color: string, count: number): void; /** Returns the most recent action name or, for a client script, the sys_id of the UI Action clicked Note: not available to Wizard Client Scripts */ getActionName(): string; /** Returns false if the field's value is false or undefined, otherwise true is returned. Useful with checkbox fields Returns true when the checkbox is checked */ getBooleanValue(fieldName: string): boolean; /** Returns the HTML element for the specified field Compound fields may contain several HTML elements. Generally not necessary as there are built-in methods that use the fields on the form */ getControl(fieldName: string): HTMLElement; /** Returns the decimal value of the specified field */ getDecimalValue(fieldName: string): string; /** Returns the HTML element for the field specified via the ID Compound fields may contain several HTML elements. Generally not necessary as there are built-in methods that use the fields on the form */ getElement(id: string): HTMLElement; /** Returns the HTML element for the form */ getFormElement(): HTMLElement; /** Returns the value of the specified field as an integer An empty value returns 0 */ getIntValue(fieldName: string): number; /** Gets the plain text value of the field label. This method is available starting with the Fuji release */ getLabelOf(fieldName: string): string; /** Returns the