Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Supported client APIs

Log in to subscribe to topics and get notified when content changes.

Supported client APIs

The following client scripting APIs are supported in Service Portal.

Supported client scripting APIs

These are the supported client scripting APIs you can use in onLoad, onChange, and onSubmit client scripts.

For detailed class and method information, see the API reference.

g_form

  • addDecoration(fieldName, icon, title)
  • addErrorMessage(message)
  • addInfoMessage(message)
  • addOption(fieldName, value, label, index)
  • clearOptions(fieldName)
  • clearValue(fieldName)
  • getActionName()
  • getBooleanValue(fieldName)
  • getDecimalValue(fieldName)
  • getDisplayValue(fieldName)
  • getEncodedRecord()
  • getFieldNames()
  • getIntValue(fieldName)
  • getLabel(fieldName)
  • getReference(fieldName, callback)
  • getRelatedListNames()
  • getSectionNames()
  • getSysId()
  • getTableName()
  • getValue(fieldName)
  • hasField(fieldName)
  • hideAllFieldMsgs(type: "info | error")
  • hideErrorBox(fieldName)
  • hideFieldMsg(fieldName, clearAll)
  • hideRelatedList(listTableName)
  • hideRelatedLists()
  • isMandatory(fieldName)
  • isNewRecord()
  • isReadOnly(fieldName)
  • isVisible(fieldName)
  • removeDecoration(fieldName, icon, title)
  • removeOption(fieldName, value)
  • save()
  • serialize(onlyDirtyFields)
  • setFieldPlaceholder(fieldName, placeholder)
  • setLabel(fieldName, label)
  • setMandatory(fieldName, isMandatory)
  • setReadOnly(fieldName, isReadOnly)
  • setSectionDisplay(sectionName, isVisible)
  • setValue(fieldName, value, displayValue)
  • setVisible(fieldName, isVisible)
  • showErrorBox(fieldName, message, scrollForm)
  • showFieldMsg(fieldName, message, type: "info | error", scrollForm)
  • showRelatedList(relatedTableName)
  • showRelatedLists()
  • submit(submitActionName)
Note: Using the variables.var_name notation with the g_form API is not supported in Service Portal.

g_list

get(fieldName)
  • addItem(value, displayValue)
  • removeItem(value)
  • reset()
  • setQuery(queryString)
  • setDefaultOperator(operator)
  • getDefaultOperator()

g_service_catalog

isOrderGuide()

GlideAjax

new GlideAjax(scriptIncludeName)
  • addParam (name, value)
  • getParam (name)
  • getXML(callback)
  • getXMLAnswer(callback)
  • getJSON(callback)
  • getXMLAnswer()
  • setErrorCallback(errorCallback)
  • getURL()
  • getParams()
  • execute()
  • successCalback(data, status, xhr)
  • errorCallback(xhr)
  • setScope(scope)

GlideRecord

new GlideRecord(tableName)
  • addQuery(encodedQuery)
  • addQuery(fieldName, operator, value)
  • getEncodedQuery()
  • get(id)
  • getTableName()
  • hasNext()
  • insert(callback)
  • gotoTop()
  • next()
  • loadRow(rowObj)
  • getValue(fieldName)
  • setValue(fieldName, value)
  • isDotWalkField(fieldName)
  • addOrderBy(fieldName)
  • setDisplayFields(fieldNames)
  • query(callback)
  • setRows(rowsArray)
  • setTableName(tableName)
  • setLimit(maxInt)
  • getLimit()

getMessage(messageKey, callback)

Feedback