Server Side Scripts Summary - ServiceNow

Core Concepts:
  • Server-side scripts execute on the ServiceNow server and have access to the database
  • Business Rules are triggered by database operations: query, update, insert, and delete
  • Business Rule script logic is executed relative to when the database operation occurs
    • before
    • after
    • async
    • display
  • Debug Business Rules using:
    • JavaScript Debugger - debug script logic
    • Debug Business Rule (Details) - debug condition script
    • Application log - view log messages
  • Use the JavaScript Debugger to debug synchronous server-side scripts
    • See variable values
    • Set breakpoints
    • View call stack
    • See transaction information
  • Script Includes are reusable server-side logic
  • On demand/classless Script Includes
    • Cannot be called from the client-side
    • Contain a single function
  • Script Includes which extend a class
    • Inherit properties of extended class
    • Do not override inherited properties
    • Most commonly extended class is GlideAjax
  • Script Includes can create a new class (does not extend an existing class)
    • Many applications have a Utils Script Include
    • Initialize function automatically invoked
    • Developer must write all properties