You may notice when using the Script Debugger on a Script Include that it does not track variables which contain GlideScriptables such as GlideDate, GlideDateTime, GlideDuration, etc.
After carefully considering the severity and frequency of this problem and the risk of attempting a fix, it has been decided to not address this issue in any current or future releases. We do not make these decisions lightly, and we apologize for any inconvenience.
Steps to Reproduce:
1. Login to instance in Orlando (or later) version.
2. Create this function as a script include:
function testscript ()
var i = 0;
var datex = new GlideDateTime();
var j = 0;
3. Set a breakpoint on the "i = 0" statement
4. Set a breakpoint on "var datex = new GlideDateTime();"
5. Start the script debugger
6. From sys.scripts.do call the script
7. Take note that the variable datex appears in the the variable list under both local and closures testscripts.
8. Step through to var j = 0. Notice that datex disappears from both.
Investigation Summary: This is how it works in all available versions
String types will work fine in the ScriptDebugger.
So, you cannot track something like "var x = new GlideDateTime ('2021-01-01');"
Alternatively, you could track something like "var x = new GlideDateTime ('2021-01-01').getDisplayValue();"