Client Side Scripting Flashcards
What are the two types of scripts found in ServiceNow?
Client Side & Server Side
———————————————————————
📁 Client Side Scripting Developer Documentation
Where do client scripts execute?
Within a user’s browser
———————————————————————
📁 Client Side Scripting Developer Documentation
When do client scripts execute?
When forms are loaded, changed, or submitted
———————————————————————
📁 Client Side Scripting Developer Documentation
What are the main 2 reasons an onLoad client script would be used?
To manipulate a form’s appearance
or manipulate a form’s content
———————————————————————
📁 Client Side Scripting Developer Documentation
When does an onLoad script execute?
When a form is loaded.
———————————————————————
📁 Client Side Scripting Developer Documentation
When does an onChange script execute?
When a particular field’s value changes.
———————————————————————
📁 Client Side Scripting Developer Documentation
Why would you use an onChange client script?
An onChange client script will allow you to monitor fields that contain values of interest and modify the values or attributes of another field based on changes to your field of interest.
———————————————————————
📁 Client Side Scripting Developer Documentation
When do onSubmit scripts execute?
When a form is submitted
———————————————————————
📁 Client Side Scripting Developer Documentation
Why would you use an onSubmit client script?
Validate field values
———————————————————————
📁 Client Side Scripting Developer Documentation
What type of API is GlideForm?
Client-side
———————————————————————
📁 Client Side Scripting Developer Documentation
What does the GlideForm API do?
Provides methods for managing form and form fields.
Some Examples:
- Retrieve a field value on a form
- Hide a field
- Make a field read-only
- Write a message on a form or a field
- Add fields to a choice list
- Remove fields from a choice list
———————————————————————
📁 Client Side Scripting Developer Documentation
What syntax is used when implementing methods from the GlideForm API?
g_form.<method></method>
———————————————————————
📁 Client Side Scripting Developer Documentation
What types of scripts support the use of the g_form object?
Client side scripts
———————————————————————
📁 Client Side Scripting Developer Documentation
Can you list off some of the methods commonly used with the g_form object?
- getValue()
- addOption()
- clearOptions()
- addInfoMessage()
- addErrorMessage()
- showFieldMessage()
- clearMessages()
- getSections()
- getSectionName()
———————————————————————
📁 Client Side Scripting Developer Documentation
What does the GlideUser API do?
Provides methods and non-method properties for finding information about the currently logged in user and their roles.
———————————————————————
📁 Client Side Scripting Developer Documentation
What syntax is used when implementing methods or accessing non-method properties from the GlideUser API?
g_user.<method></method>
———————————————————————
📁 Client Side Scripting Developer Documentation
What information would the following code display in a brand new ServiceNow developer instance?
g_user.firstName
System
———————————————————————
📁 Client Side Scripting Developer Documentation
What information would the following code display in a brand new ServiceNow developer instance?
g_user.lastName
Administrator
———————————————————————
📁 Client Side Scripting Developer Documentation
What information would the following code display in a brand new ServiceNow developer instance?
g_user.userName
admin
———————————————————————
📁 Client Side Scripting Developer Documentation
What information would the following code display in a brand new ServiceNow developer instance?
g_user.userID
This returns the sys_id for the individual
———————————————————————
📁 Client Side Scripting Developer Documentation
What types of scripts support the use of the g_user object?
Client side scripts
———————————————————————
📁 Client Side Scripting Developer Documentation
Can you list off some of the methods most commonly used with the g_user object?
- hasRole()
- hasRoleExactly()
- getFullName()
———————————————————————
📁 Client Side Scripting Developer Documentation
What are the similarities between client side scripts and UI policies?
&
What are the differences between client side scripts and UI policies?
They are both client side logic that governs form and form field behavior.
&
UI policies don’t require any scripting
———————————————————————
📁 Client Side Scripting Developer Documentation
What are UI policy actions?
Client side logic within a UI policy, used to set three field attributes:
- Mandatory
- Visible
- Read Only
———————————————————————
📁 Client Side Scripting Developer Documentation