Script not working in Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2019 11:54 PM
We have some scripts which removes Category values based on the view. The below category is working fine in Incident 'default view' , however it doesn't work in Agent Workspace. I have changed the UI type to All but it still doesn't work. Is it true that GlideRecord is not supported in Agent workspace at all?
Can someone help or convert this into GlideAjax to get it working if possible?
function onLoad() {
var sd = false;
//Type appropriate comment here, and begin script below
var objView = document.getElementById('sysparm_view');
var strView = objView.getAttribute('value');
var category = g_form.getValue('category');
var ri = new GlideRecord('sys_choice');
var asgrp = g_form.getValue('assignment_group');
if (asgrp != '070a28ca0a0aa02e01ac6d7bd6ddab6b' && asgrp != '6dfbd5f00a0aa02e01f7eebe4998eb13' && asgrp != '070a26580a0aa02e009bb544858499a7') {
sd = false;
} else {
sd = true;
}
// hide GBO OPTIONS FOR CATEGORY
if (strView != 'GBO' && category.indexOf('GBO -') < 0 && !sd) {
ri.addQuery('element', 'category');
ri.addQuery('label', 'LIKE', 'GBO -');
ri.query();
while (ri.next()) {
g_form.removeOption('category', ri.value, ri.label);
}
} else if (sd) {
return;
} else {
// hide other category for GBO SRM
//var ri = new GlideRecord('sys_choice');
ri.addQuery('element', 'category');
ri.addQuery('label', 'DOES NOT CONTAIN', 'GBO -');
ri.query();
while (ri.next()) {
g_form.removeOption('category', ri.value, ri.label);
}
}
}
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2019 12:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2019 12:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2019 01:01 AM
It was already on form, have checked it to true but it's still not working in Agent Workspace view. It wasn't working before too when it was checked to false.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2019 02:44 AM
Hi,
I also see that you are using var ri = new GlideRecord('sys_choice');
please make use of GlideAjax and not Gliderecord.
Thanks,
Ashutosh