0% found this document useful (0 votes)
45 views10 pages

Glide Forms

This document provides information on methods available in the Glideform API in ServiceNow that allow developers to programmatically interact with forms and fields to access and modify form data. Key methods described include adding decorations, messages, options and clearing values for specific fields, as well as getting display values and boxes.

Uploaded by

Prem Kumar Vula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views10 pages

Glide Forms

This document provides information on methods available in the Glideform API in ServiceNow that allow developers to programmatically interact with forms and fields to access and modify form data. Key methods described include adding decorations, messages, options and clearing values for specific fields, as well as getting display values and boxes.

Uploaded by

Prem Kumar Vula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Glideforms

Sit Dolor Amet


Title Lorem Ipsum

Lorem Ipsum Lorem Ipsum Lorem Ipsum


Dolor Sit Amet Dolor Sit Amet Dolor Sit Amet
Consectetuer Elit Consectetuer Elit Consectetuer Elit
Nunc Viverra Nunc Viverra Nunc Viverra
 Glideform API: This API method is used to interact with forms and fields on the ServiceNow platform. Developers can use this method to access
form data, validate form data, and set form values programmatically.

1. addDecoration(String field Name, String icon, String title):


It is a method that allows you to add an icon decoration to a specific field in a form.
function onLoad() {

   g_form.addDecoration('caller_id',' icon-star','ungamma','color-green');  

 addErrorMessage(String message)
Displays the specified error message at the top of the form.This message appears for approximately four seconds and then disappears
function onLoad() {
    g_form.addErrorMessage('Please assign the ticket to a support group.');
}

addFormMessage(String message, String type)


Displays a floating form message at the top of the form detail section. The message does not cover UI actions
The type of message: Error-red color message , info: Blue , Warning: yellowish color
function onLoad() {
    g_form.addFormMessage('Please save the form', 'info');
    g_form.addFormMessage('update the form', 'warning');
    g_form.addFormMessage('error message', 'error');
}
 addInfoMessage(String message)
Adds the specified informational message to the top of the form. This message appears for approximately four seconds and then disappears.
 addOption( fieldName, choiceValue, choiceLabel): Adds a choice to the end of a choice list field.

Name Type Description


fieldName String The name of the field.
choiceValue String The value to be stored in
the database.
choiceLabel String The value displayed.

Choice index string Order of the choice in the


function onLoad() { list
    g_form.addOption('state','9','Ungamaa',3);
}
 clearMessages()
Removes all informational and error messages from the top of the form. Removes informational and error messages added
with g_form.addInfoMessage() and g_form.addErrorMessage().

function onLoad() {

    g_form.clearMessages();

}
 clearValue(String fieldName)
 Removes any value(s) from the fiel
function onLoad() {
    g_form.clearValue('short_description');
}
 flash(String fieldName, String color, Number count )
Used to draw attention to a particular field. Flashes the specified color for a specified duration of time in the specified field.
This method is not supported by Service Catalog
function onLoad() {
    g_form.flash('caller_id', 'orange', -4);
    g_form.flash('category', 'white', -4);
    g_form.flash('subcategory', 'green', -4);
}

 getDecimalValue():
 Returns the decimal value of the specified field.
function onChange(control, oldValue, newValue, isLoading) {
   alert(g_form.getDecimalValue('percent_complete'));
}
 The getDisplayBox(String fieldName):
This method is used to retrieve the display box for a specified field in a form.
The display box represents the bounding rectangle of the field on the form, including any padding and borders. The method takes a
single parameter, fieldName, which is a string representing the name of the field for which to retrieve the display box.
function onLoad() {
    var caller = g_form.getDisplayBox('caller_id');
    var assignee = g_form.getDisplayBox('assigned_to');
    if (caller.value == assignee.value) {
        g_form.clearMessages();
        g_form.addInfoMessage('The Caller and Assignee are the same person.');
    }
}

 getDisplayValue(String fieldName)
 Gets the display value from a form in Service Portal.

You might also like