We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

GlideAjax not calling Script Include on Catalog Item submit (Service Portal)

NikhithaNikki
Tera Contributor

Hi all,
I’m facing an issue while trying to create a Hardware Disposal Order from a Catalog Item (Service Portal / Employee Center) using GlideAjax, and I’m hoping for guidance on the correct approach.
Requirement

On catalog item submission, create a record in sn_hamp_hardware_disposal
Pass values like Stockroom and Location from the form
Use a Script Include (AbstractAjaxProcessor) to handle record creation


What I Implemented

Created a Client Callable Script Include in the sn_hamp scope extending AbstractAjaxProcessor
Calling it from a Catalog Client Script (onSubmit) using GlideAjax

client script

function onSubmit() {
var ga = new GlideAjax('QuestHardwareDisposalOrder');
ga.addParam('sysparm_name', 'createDisposalOrder');
ga.addParam('sysparm_stockroom', g_form.getValue('select_stockroom'));

ga.getXMLAnswer(function() {
g_form.submit();
});

return false;
}

script include

var QuestHardwareDisposalOrder = Class.create();
QuestHardwareDisposalOrder.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
 
    createDisposalOrder: function() {
        gs.log('[Nikhitha] createDisposalOrder called');
        var stockroom = this.getParameter('sysparm_stockroom');
        var location = this.getParameter('sysparm_location');
        var dis = new GlideRecord('sn_hamp_hardware_disposal');
        dis.initialize();
        dis.stockroom = stockroom;
        dis.location = location;
        dis.assigned_to = gs.getUserID();
        dis.insert();
 
        return "Disposal Order Created: " + dis.number;
    },
 
    type: 'QuestHardwareDisposalOrder'
});
 

Issue

The catalog item submits successfully
But the Script Include is not called
No logs appear (gs.info does not log)
No record is created in sn_hamp_hardware_disposal

7 REPLIES 7

GlideFather
Tera Patron

Hi @NikhithaNikki,

 

what do you have here in your script include?

Screenshot 2026-04-16 at 22.24.30.png

 

Silly question - what about scopes?


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

The script include I have "accessible from this application scope only" but I also calling it from the same scope and same scope I have created script include.

yashkamde
Mega Sage

Hello @NikhithaNikki ,

 

Please check SC is returning something, even though gs.log not called  :

var ga = new GlideAjax('QuestHardwareDisposalOrder');
   ga.addParam('sysparm_name', 'createDisposalOrder');
   ga.addParam('sysparm_stockroom', g_form.getValue('select_stockroom'));
   ga.addParam('sysparm_location', g_form.getValue('location'));

   ga.getXMLAnswer(function(response) {
      alert('script include returned: ' + response);
       return true;
   });
 

 

If my response helped mark as helpful and accept the solution.

No it's returning nothing,not even script include getting called and I written onsubmit catalog client script in that written glideajax