According the the SN documentation, it is not possible to use the Script Debugger to debug GlideAjax Script Includes such as CSDANZextAjax. However I have written a new Script Include called: AjaxScriptIncludeTester which makes this possible. You can use AjaxScriptIncludeTester to execute your Ajax Script Include using a Background Script as shown below.
Testing using a Script
If you use this script include (below) for Testing Ajax Script Include, you can use the Interactive Debugging Utility.
Test Script
This is sample Test Script for using the AjaxScriptIncludeTester
// Set the initial Parameters, the name and sys_id of the sn_client_sf_dist_sccm_collection_group_relationship record.
var tester = new AjaxScriptIncludeTester(global.CSDANZextAjax);
tester.addParam("sysparm_pkgid","220322c11bfb2c109df2fe6d0d4bcba8");
tester.addParam("sysparm_pkgname", "Adobe Acrobat DC 19.021.20049.X64.NZ.R01");
var csdAjax = tester.getInstance();
// Now Execuite the functio you want to Test.
csdAjax.getSCCMAppDetails();
var id = tester.getParam("sysparm_pkgid");
var name = tester.getParam("sysparm_pkgname");
gs.log(id);
gs.log(name);
Script Include for Testing Ajax Script Includes
If you use this script include for Testing Ajax Script Include, you can use the Interactive Debugging Utility.
/* Last Modified: Doug Connell 20201-05-04
Function for Testing Script Includes
EXAMPLE:
// --------------------------------------------
// Set the initial Parameters, the name and sys_id of the sn_client_sf_dist_sccm_collection_group_relationship record.
var tester = new AjaxScriptIncludeTester(global.CSDANZextAjax);
tester.addParam("sysparm_pkgid","220322c11bfb2c109df2fe6d0d4bcba8");
tester.addParam("sysparm_pkgname", "Adobe Acrobat DC 19.021.20049.X64.NZ.R01");
var csdAjax = tester.getInstance();
// Now Execuite the functio you want to Test.
csdAjax.getSCCMAppDetails();
// --------------------------------------------
*/
var AjaxScriptIncludeTester = Class.create();
AjaxScriptIncludeTester.prototype = {
// =====================================================
initialize : function(ajaxScriptInclude) {
this.ajaxScriptInclude = ajaxScriptInclude;
this.request = new ADC_AjaxScriptIncludeTesterRequest();
this.responseXML = {};
this.gc = {};
},
// =====================================================
setParameter: function(prop, val) {
this.request.setParameter(prop,val);
},
// =====================================================
addParam: function(prop, val) {
this.request.setParameter(prop,val);
},
// =====================================================
getParameter: function(prop) {
return this.request.getParameter(prop);
},
// =====================================================
getParam: function(prop) {
return this.request.getParameter(prop);
},
// =====================================================
getInstance: function(prop) {
this.myAjax = new this.ajaxScriptInclude(this.request, this.responseXML, this.gc);
return this.myAjax;
},
// =====================================================
type: 'AjaxScriptIncludeTester'
};
// ########################################################################
var ADC_AjaxScriptIncludeTesterRequest = Class.create();
ADC_AjaxScriptIncludeTesterRequest.prototype = {
initialize : function(request, responseXML, gc) { this.props = {}; },
setParameter: function(prop, val) {
this.props[prop] = val;
},
getParameter: function(prop) {
return this.props[prop];
}
};
Leave a Reply