On Change Client Script Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 03:34 AM
I have a OnChange client script running on a catalog item, that runs when the value of a "u_subcategory" variable changes. And, I just want to get the value of "u_subcategory" variable. I'm using the g_form.getValue() method but it's not working, then I used g_scratchpad, but that's too not working. I have checked the ServiceNow logs table, and it is giving the below error:
Exception while executing request: stream has already been operated upon or closed: com.glide.rest.util.RESTRuntimeException: Exception while executing request: stream has already been operated upon or closed: com.glide.rest.handler.impl.ServiceHandlerImpl.handleInvocationTargetException(ServiceHandlerImpl.java:76)
com.glide.rest.handler.impl.ServiceHandlerImpl.invokeService(ServiceHandlerImpl.java:49)
com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:346)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:733)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:291)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:187)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:175)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:58)
com.glide.sys.Transaction.run(Transaction.java:2645)
com.glide.ui.HTTPTransaction.run(HTTPTransaction.java:30)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java.base/java.lang.Thread.run(Thread.java:829)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 06:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 07:45 AM
var ajax = new GlideAjax('SG_submit_a_ticket');
I tried GlideAjax now, I want to check if the value of the subcategory is "Power BI Access Request", then show the variable "name_of_report". But I'm not getting the "u_subcategory" value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 10:19 AM
getSubcategoryValue: function() {
var cat = this.getParameter('sysparm_category');
gs.info('Category parameter: ' + cat);
var gr = new GlideRecord('sys_choice');
gr.addEncodedQuery("name=incident^element=subcategory^inactive=false^dependent_value=" + cat);
gr.query();
if (gr.next()) {
gs.info('Subcategory value: ' + gr.getValue('value'));
return ''+ gr.getValue('value');
}
gs.info('No subcategory found');
return '';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 02:26 AM - edited 12-23-2024 02:30 AM
Hi @Aqil ,
ajax.getXMLAndWait(); Is incorrect method instead use ajax.getXMLWait();
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand