Scripting class Flashcards
Client side scripts are run on the browser and handle what kind of functions?
They can auto populate a field based on the value of another field
Show or hide form sections
They have access to data on forms and in lists
Server side scripts are generally used for what purpose
These typicall modify a database record or generate an event
These have access to the actual database unlike client side scripts
MID server scripts are generally used for what purpose
to integrate to a 3rd party application
The syntax editor uses color coding including Green, Purple, and Blue. What do each of these colors mean?
Green are comments
Purple are JavaScript commands
Blue are strings and reserved words
What is the keyboard shortcut to display a list of valid elements at the cursor’s current position?
control + spacebar at the beginning of a line
What is the keyboard shortcut to list methods for a class?
period after a valid class name
What is the keyboard shortcut to list expected parameters
Open parenthesis after a valid class, function, or method name
Do properties that have been locally declared appear in the context-sensitive help?
Yes they do
Is the following class used on the client or server side:
GlideAjax
Client Side
Is the following class used on the client or server side:
Glide Aggregate
Server - Side
Is the following class used on the client or server side:
GlideForm
Client - Side
Is the following class used on the client or server side:
GlideDateTime
Server Side
Is the following class used on the client or server side:
GlideList
Client-side
Is the following class used on the client or server side:
GlideElement
Server - side
Is the following class used on the client or server side:
GlideRecord
Client - Side
Is the following class used on the client or server side:
GlideRecord
Server - Side
Is the following class used on the client or server side:
GlideUser
Client-Side
Is the following class used on the client or server side:
GlideSystem
Server-Side
Is the following class used on the client or server side:
spModal
Client-Side
Is the following class used on the client or server side:
JSON
Server-Side
Is the following class used on the client or server side:
Workflow
Server-side
A client script manages the behavior of forms, fields, and lists in real time including the following:
- Make fields mandatory
- set one field in response to another
- modify choice of list options
- hide/show form sections
- display an alert
- hide fields
- prohibit list editing
These execute client side
When there are multiple client scripts executing what order do they go in?
This is only an issue if they are on the same table and they will execute based on their order number from lowest to highest.
How does an onLoad() client script work
This script runs when a form loads and before control is given to the user. It is typically used to manipulate a form’s appearance or content on screen.
Users are not able to modify the form while an onLoad script executes
How does an onSubmit() script work
This runs when a form is saved, updated, or submitted and is typically used for field validation
What does the following code do:
function onSubmit() {
if (!myCondition) {
return false;
else {
//perform some logic here
}
}
This runs on form submission and will cancel the submission if “myCondition” isn’t met. Return false is what cancels the process.
How does an onChange() script work
This script runs when a particular field value changes. It is typically used to respond to field values of interest, modify one field value in response to another. An onchange script can only watch one field at a time.
What are the five parameters automatically passed to an onChange client script and what do they do?
- control - name of the object(field_name) whose value just changed. The object is identified in the Field name field on the Client Script form.
- oldValue - value of the control field when the form loaded and prior to the change. The old value is always what it was when the form loaded no matter how many times it is changed
- newValue - value of the control field after the change
- isLoading - boolean value indicating whether the change is occuring as part of a form load. Value is true if chane is due to a form load. A form load means all of a form’s field values changed
- isTemplate - boolean value indicating whether the change occurred due to population of the field by a template. Value is true if change is due to population from a template.
How does the onCellEdit() script work?
Script runs when a particular field value on a list changes. Applies to all records selected. This can be used to ensure data being controlled via scripts on a form has similar constraints on a list view.
Does not apply to widgets on homepages or dashboards.
what parameters are automatically passed to an onCellEdit() Client Script
- sysIDs - sys_id of the edited item(s)
- table - the table name of the edited item(s)
- oldValues - the old value of the edited cell(s)
- newValue - the new value of the edited cell(s). Is the same for all edited items.
- callback - a callback will continue the execution of other related cell edit scripts
what does the following function do:
This script defaults to save and close but if the new value of state is either resolved or closed the value of save and close is changed to false. When this happens the callback function that calls the variable gets the new value of false meaning it won’t run and it also alerts the user that they are unable to make that change.
What are the three most popular client-side APIs
g_form - object whose properties are methods used to manage a form and its fields in the record
g_user - object whose properties contain session information about the currently logged in user and their role(s)
g_scratchpad - object passed to a client script from a server-side script known as a display business rule. The object’s properties and values are determined by the server side script.
What can you use to access GlideForm methods
g_form global object
for example:
g_form.setValue(‘impact’,1);
g_form.showFieldMsg(‘state’,’Change is waiting approval’,’info’);
What g_form methods are used to:
Draw attention to an area on the form
flash() - flashes a field’s label to draw attention to it
showFieldMsg() - displays a message under a form field