GlideForm Flashcards
How do you invoke the GlideForm object?
g_form.someFunction()
What overall functionality does GlideForm provide?
These methods are used to make custom changes to the form view of records.
Is GlideForm client side or server side?
Client Side
Adds an icon on a field’s label in Client Script
g_form.addDecoration(String fieldName, String icon, String title)
OR
g_form.addDecoration(String fieldName, String icon, String title, String color)
Displays the specified error message at the top of the form in Client Script
g_form.addErrorMessage(String message)
Adds the specified informational message to the top of the form in Client Script
g_form.addInfoMessage(String message)
Adds a choice to the end of a choice list field in Client Script
g_form.addOption(String fieldName, String choiceValue, String choiceLabel)
Adds a choice to the choice list field at the position specified in Client Script
g_form.addOption(String fieldName, String choiceValue, String choiceLabel, Number choiceIndex)
Removes all informational and error messages from the top of the form in Client Script
g_form.clearMessages()
Removes all options from the choice list in Client Script
g_form.clearOptions(String fieldName)
Removes any value(s) from the field in Client Script
g_form.clearValue(String fieldName)
Prevents file attachments from being added to the form in Client Script
g_form.disableAttachments()
Allows file attachments to be added to the form in Client Script. Shows the paper clip icon.
g_form.enableAttachments()
Used to draw attention to a particular field. Flashes the specified color for a specified duration of time in the specified field in Client Script.
g_form.flash(String fieldName, String color, Number count)
This method is not supported by Service Catalog.
Returns the most recent action name, or, for a client script, the sys_id of the UI action clicked in Client Script
g_form.getActionName()
Returns a Boolean value for the specified field in Client Script
g_form.getBooleanValue(String fieldName)
Returns the HTML element for the specified field in Client Script
g_form.getControl(String fieldName)
Compound fields may contain several HTML elements. This method is generally not necessary as there are built-in methods that use the fields on a form.
If the field is a reference field and the control is a choice list, getControl() may not return a control as expected. In this case, use sys_select…
Returns the decimal value of the specified field in Client Script
g_form.getDecimalValue(String fieldName)
Returns the HTML element specified by the parameter in Client Script
g_form.getElement(String id)
Compound fields may contain several HTML elements. This method is generally not necessary as there are built-in methods that use the fields on a form.
Returns the HTML element for the form in Client Script
g_form.getFormElement()
Returns the HTML element of the help text for the specified field in Client Script
g_form.getHelpTextControl(String fieldName)
This method is applicable to service catalog variables only.
Returns the integer value of the field in Client Script
g_form.getIntValue(String fieldName)
Returns the plain text value of the field label in Client Script
g_form.getLabelOf(String fieldName)
Returns the option element for a selected box named fieldName where choiceValue matches the option value in Client Script
g_form.getOption(String fieldName, String choiceValue)
This method does not work on read-only fields.
Returns the GlideRecord for a specified field in Client Script
g_form.getReference(String fieldName, Function callBack)
If a callback function is present, this routine runs asynchronously. The browser (and script) processing continues normally until the server returns the reference value, at which time, the callback function is invoked. If a callback function is not present, this routine runs synchronously and processing halts (causing the browser to appear to hang) while waiting on a server response.
Important: It is strongly recommended that you use a callback function.
Callback function support for ServiceCatalogForm.getReference is available.
Returns an array of related lists from the current form in the order in which they appear on that form in Client Script
g_form.getRelatedListNames()
Returns all section names, whether visible or not in Client Script
g_form.getSectionNames()
Returns an array of the form’s sections in Client Script
g_form.getSections()
Returns the name of the table to which this record belongs in Client Script
g_form.getTableName()
Returns the sys_id of the record displayed in the form in Client Script
g_form.getUniqueValue()
Returns the value of the specified form field in Client Script
g_form.getValue(String fieldName)
This method also supports getting values from a multi-row variable set (MRVS). To obtain data from fields within an MRVS, you must first use JSON.parse(getValue(‘’)) to obtain the MRVS array, and then use indexing to access the fields within the row objects. For more details, see the code example below.
Hides all field messages in Client Script
g_form.hideAllFieldMsgs()
Hides all field messages of the specified type in Client Script
g_form.hideAllFieldMsgs(String type)
Hides the last message or all messages placed by showFieldMsg() in Client Script
g_form.hideFieldMsg(String fieldName)
OR
g_form.hideFieldMsg(String fieldName, Boolean clearAll)
Hides the specified related list on the form in Client Script
g_form.hideRelatedList(String listTableName)
Hides all related lists on the form in Client Script
g_form.hideRelatedLists()
Returns true while a live update is being done on the record the form is showing in Client Script
g_form.isLiveUpdating()
Returns true if the field is mandatory in Client Script
g_form.isMandatory(String fieldName)
Returns true if the record has never been saved in Client Script
g_form.isNewRecord()
Returns true if the section is visible in Client Script
g_form.isSectionVisible(String sectionName)
Registers a custom event listener that detects when any field in the current form is modified by a user in Client Script
g_form.onUserChangeValue(Function fn)
NOTE: Doesn’t work for journal fields
Updates a list collector variable in Client Script
g_form.refreshSlushbucket(String fieldName)
Removes the icon from the specified field that matches the icon and title in Client Script
g_form.removeDecoration(String fieldname, String icon, String title)
OR
g_form.removeDecoration(String fieldname, String icon, String title, String color)
NOTE: Not supported by Service Catalog
Removes the specified option from the choice list in Client Script
g_form.removeOption(String fieldName, String choiceValue)
Saves the record without navigating away (update and stay) in Client Script
g_form.save()
Makes the specified field available or unavailable in Client Script
g_form.setDisabled(String fieldName, Boolean disable)
Displays or hides a field in Client Script
g_form.setDisplay(String fieldName, Boolean display)
NOTE: Use UI Policies instead
Sets the plain text value of the field label in Client Script
g_form.setLabelOf(String fieldName, String label)
Makes the specified field mandatory in Client Script
g_form.setMandatory(String fieldName, Boolean mandatory)
NOTE: Use UI Policies instead
Makes the specified field read only or editable in Client Script
g_form.setReadOnly(String fieldName, Boolean readOnly)
NOTE: Use UI Policies instead
Shows or hides a section in Client Script
g_form.setSectionDisplay(String sectionName, Boolean display)
Sets the value of a specified form field to the passed in value in Client Script
g_form.setValue(String fieldName, String value)
This method also supports setting values in a multi-row variable set (MRVS). You must first use JSON.parse(getValue(‘’)) to obtain the MRVS array and then use indexing to update the fields within the row objects. Once all values are updated in the MRVS, use the setValue() method to save the updated MRVS array.
Sets the value of a specified form field to the value of a specified display value in a reference record in Client Script
g_form.setValue(String fieldName, String value, String displayValue)
NOTE: To improve performance by preventing a round trip when setting the value for a reference field, use this method, not setValue(fieldName, value). When setting multiple reference values for a list collector field, pass arrays in the value and displayValue parameters.
Displays or hides the field in Client Script
g_form.setVisible(String fieldName, Boolean display)
NOTE: Use UI Policies instead
Displays an error message under the specified form field (either a control object or the name of the field) in Client Script. If the control or field is currently off the screen, the form scrolls to the control or field
g_form.showErrorBox(String name, String message)
OR
g_form.showErrorBox(String name, String message, Boolean scrollForm)
Displays either an informational or error message under the specified form field (either a control object or the name of the field) in Client Script. If the control or field is off the screen, the form is scrolled to the field.
g_form.showFieldMsg(String field, String message, String type)
OR
g_form.showFieldMsg(String field, String message, String type, Boolean scrollForm)
Displays the specified related list on the form in Client Script
g_form.showRelatedList(String listTableName)
Displays all the form’s related lists in Client Script
g_form.showRelatedLists()
Saves and closes the record in Client Script
g_form.submit()
Performs the UI action specified by the parameter in Client Script
g_form.submit(String verb)