Can the Script Debugger debug during a GlideAjax transaction?

gavin17
Tera Contributor

Hi,

I'm wondering if anyone has successfully used ServiceNow Instanbul Script Debugger tool to successfully debug a complete GlideAjax transaction?

I have an AbstractAjaxProcessor implementation in a Script Include that I want to debug when called from a client-side GlideAjax request.   The client-side request is structured like this:

var ga = new GlideAjax("MyAppScope.MyGlideAjaxImplementation");

ga.addParam("sysparm_name", "myFunction");

ga.getXMLAnswer(function (result) {console.log(result);});

When the Script Debugger is launched and a breakpoint is set within MyGlideAjaxImplementation.myFunction(), the debugger will not halt.

However, if I use Scripts - Background to directly invoke the MyGlideAjaxImplementation.myFunction(), the debugger halts on my breakpoint.

I can confirm that myFunction() is being called through GlideAjax.   However, it "seems" like the indirect method GlideAjax uses to invoke the function from client to server-side is not detected by Script Debugger?   Is this true?   Is there still a way to debug?

3 REPLIES 3

Julian Hoch
ServiceNow Employee
ServiceNow Employee

At the moment, no.



See: Script debugger



"The Script Debugger can pause any server-side script that runs in an interactive transaction such as business rules, script includes, script actions, or UI actions that require a response in order to proceed. If the GlideSystem method isInteractive() would return true when running the script in context, then the Script Debugger can pause it."



You might however trigger the method in your script include manually from a background script (without using GlideAjax) to debug the method in an interactive context.


ggg
Giga Guru

I have the same issue. OOB Test Management uses a GlideAjax call to perfom server processes.

If I add a breakpoint to the script include that is running the debugger does NOT stop.

The debugger does work with a run of the mill business rule.

Running the script include from a background script is not a feasible option.

Has anyone found a solution to this?

 

bai
Tera Contributor

Hi,

I'm sorry I have the same problem but it seems like its not possible,

but can you tell me how to

 use Scripts - Background to directly invoke the MyGlideAjaxImplementation.myFunction()

and make the debugger halts on the breakpoint within the function area

cause I tried to use a local client script to invoke the Ajax function , I tried like 100 times just 1 worked!

I am so confused.....

please tell me really need your help