GlideAjax not calling Script Include on Catalog Item submit (Service Portal)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @NikhithaNikki,
what do you have here in your script include?
Silly question - what about scopes?
Answers generated by GlideFather. Check for accuracy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
No it's returning nothing,not even script include getting called and I written onsubmit catalog client script in that written glideajax
