Script Debugging
tip
Role required: admin.
To debug a script, you can use a built-in debugger.
For debugging use only the system instances intended for developing and testing business solutions, where there is no sensitive data, to avoid its loss or corruption.
You can use the try... catch
blocks for script debugging.
caution
Before debugging, pay attention to the SimpleRecord methods:
- insert()
- update()
- updateMultiple()
- deleteRecord()
- deleteMultiple()
Escape these methods or remove them to prevent data corruption or loss.
To debug a script, do the following:
- Navigate to System Settings → Server Scripts.
- Click New and fill in the fields.
- Click Save or Save and exit to save the script, or click Run to execute it without saving.
You can also open any record form in this debugger by calling the Open in script item in the burger menu.
With this functionality, you can:
- locate breakpoints within the script body.
- comment some strings to skip one or more operations.
- display the object value before inserting or updating.
- display the variable value when executing.
It is recommended to use SimpleSystem methods to display values when debugging a server-side script:
- To display them on the client-side:
- ss.addInfoMessage(message)
- ss.addErrorMessage(message)
- To put them into the Main Log (sys_log) table, which is intended as the main log storage:
- ss.info(message)
- ss.warning(message)
- ss.debug(message)
- ss.error(message)