Scripting Module 2 Flashcards
What is a client script?
Manage the behavoir of forms, fields and lists in real time
When does an onLoad client script run?
script runs when a form loads and before control is given to the user
When does a onSubmit client script run?
Script runs when a form is save or submitted
When does a onChange client script run?
Script runs when a particular field value changes.
What parameters does the onChange client script have?
control
oldValue
newValue
isLoading
isTemplate
When does a onCellEdit client script run
Script runs when a field is edited from a list view
What parameters does the onCellEdit client script have?
sysIDs
table
oldValues
newVlaue
callback
What are the most popular client side API’s
g_form
g_user
g_scratchpad
What are common used g_form methods?
flash()
showFieldMsg()
getValue()
setValue()
clearValue()
addOption()
clearOption()
getSections()
isNewRecord()
addFormMessage()
clearAllFormMessages()
What does g_form.getValue() do?
Retrieves a field value from the form. Always returns as string
Text field - returns the content
Choice list - returns the value not the label
Reference - returns the sys_id
What are the g_user properties?
firstName
lastName
userID
username
what are the g_user methods?
getClientData()
getFullName()
hasRole()
hasRoleExactly()
hasRoleFromList()
hasRoles()
What script debugging strategies are available?
ServiceNow built in debugging tools
–script debug messages (addInfoMessage and addErrorMessage())
–JavaScript Log and jslog()
–Response Time Indicator
Javascript debugging tools
–alert()
–try/catch
Browser tools (javascript console, web console
Third party tools