Technical Best Practices
Technical Best Practices
Before you start debugging, it is important to identify the source of the issue, and to be able to
reproduce the defect or bug. Potential sources include user error, invalid test data, test script
inaccuracy, and technical implementation. To help identify and remediate the issue, the tester should
provide the following information:
Server-side Debugging:
Debug Log-
• System Diagnostics > Debug Log displays gs.debug(), gs.info(), gs.print() and gs.log()
statements as well as server logging information and error messages at the bottom of the
content frame.
• This helps you avoid alternating between the record you are trying to debug and the log
output.
• System Diagnostics > Debug Business Rule displays messages about business rules.
• These messages indicate which business rules are being run and when they are started (==>),
finished (<==), or skipped (===). If a business rule is skipped, the failed condition is displayed.
• System Security > Debug Security Rules places a debug icon on each field of a form.
• Point to the icon to see if there are any debug messages for the associated element. Click the
icon to expand details about read and write access. This module is very helpful when you are
using ACLs to control access to records and fields.
Stop Debugging-
When you activate a server-side debugging module, it remains active until one of the following
occurs:
1. You activate the Stop Debugging module, located in System Security.
2. You log out from the instance.
3. The session expires (for example, the session times out).
4. You close the browser.
The recommended way to debug server-side scripts is to use gs.debug() statements controlled by
system properties. It enables you to have distinct debugging in script includes so they can each be
debugged independent of each other.
• gs.print() and gs.log() are older and not available in scoped applications, whereas gs.debug(),
gs.info(), gs.warn(), gs.error() work in both scoped applications and global are therefore are
more versatile going forward in future versions.
• Another helpful function gs.isDebugging() and can be used to determine if session debugging
is on OR the scoped property is debug.
Other Methods-
Client-Side Debugging:
• To debug processes on the client side, click the settings icon in the banner frame, select
Developer from the menu and turn on JavaScript Log and Field Watcher.
• This will open the log viewer at the bottom of the window. Along with useful system
information, you may choose to include jslog() statements in client scripts and UI policy
scripts to help isolate and resolve issues.
• Unlike server-side debug statements, jslog() statements in client-side scripts do not consume
disk space. This means you can leave them enabled, even in production.
• alert() statements should be avoided if possible.
Disabling Debugging:
• Before you close out an update set or complete testing of the production instance, be sure to
disable all server-side debugging to save log space in production. To disable debugging,
search for all system properties that contain the string debug in the name and ensure they
are all set to false.
• This is another good reason to use properties to control debugging in a script. It makes
enabling or disabling debugging a simple task, such as when you need to validate use cases
or data.