Katherine4
Tera Expert

This technique does require you have the Xplore: Developer Toolkit installed on your instance.  With Xplore and Script Debugger I cannot remember the last time I had to use gs.log() to debug anything.

The example code snippet below provides all you need to test any Client Callable Script Include.  Simply change the names and values being tested to suit your specific need.

var mockRequest = {
        "sysparm_name": "getSubscriptionCount",
        "sysparm_sys_id": "aea24ac2c611227101fe910c323fb00e",
        getParameter: function (name) {
            return this[name];
        }
    },
    mockAjax = new SubscribedUserAjax(mockRequest);
mockAjax.process();

Step 1.

Set a Break Point in the Script Include being tested and Activate Script Debugger.

find_real_file.png

Step 2.

Open a tab for Xplore and paste in the code snippet.

Step 3.

Click "Run"

find_real_file.png

 

As a teaser, am thinking the topic of a follow up article will show how you can combine this technique with ATF for server-side coverage of your AJAX scripts.  That's a not so subtle hint at increasing that Helpful number.

Comments
The SN Nerd
Giga Sage
Giga Sage

Writing GlideAjax scripts no longer needs to be a baffling ordeal!

Version history
Last update:
‎07-29-2022 11:50 PM
Updated by: