Scripting Module 5 Flashcards
What is a business rule?
JavaScritpt that runs when a record is displayed, inserted, updated, or deleted or a table is queried
When does a before query business rule run?
Executes before a query is sent to database
When does a display business rule run?
Executes after the data is read from the database and before the form is presented to the user
What is the primary purpose of display business rule?
Populate g_scratchpad global object
When does a Before business rule run?
Executes after form submission and before record is updated in database
When does an After business rule run?
Executes after form submission and record update in the database
When does an Async business rule run?
Queued by the scheduler to run as soon as they can be fit in.
What predefined server side global variables are available in a business rule?
Current - object that stores the current record’s fields
Previous - object that stores the records fields values before any changes were made
g_scratchpad - display rules only
What are the informational icons in the script tree?
Table - indicates the field references another table
Blue circle - field resides on the current table
Red square - field resides on a parent table
Index field icon - field is part of one or more indexes
What are the Glide System Logging Methods?
Sent to the system log
gs.info()
gs.log() - global scope only
gs.error()
gs.warn()
gs.debug()
Sent to top of form
gs.addInfoMessage()
gs.addErrorMessage()
How do you debug Business rules?
GlideSystem logging methods
Debug Business Rules
Script Debugger
Script Tracer
Console Debugger
Try/catch
What does the Script Debugger offer?
The ability to step through your script line by line
Set and remove breakpoints
Pause at a breakpoint
Step into and out of function and method calls
View the value of local and global variables
View the value of private variables
View the call stack
View the transaction the system is processing
What are the script debugger controls?
Start Debugging
Pause Debugging
Resume Script Execution
Step Over next function
Step into next function
Step out of current function
What does the script tracer do?
Helps you filter your debugging search to quickly narrow down script problems.
What are good practices for business rules
Use Async Business rules whenever possible
Use Display Business Rules to pass data from server-side to client-side during form load (g_scratchpad)
Write condition statements in the condition field
Add the description field to the Business Rule for to document what the rule does
Choose an appropriate debugging strategy
Comment your scripts