Incident ticket - show a restricted list of Category selection based on assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 01:22 PM
I want to show a limited list of Category choices when a specific assignment group is selected.
show only categories that are for an assignment group to select.
If assignment group contains 'ACSES' only allow the following Category to be selected: ACSES
Dont want to show the other selections (Inquiry/Help, Software, Hardware, Network, Database, CORE)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 03:31 PM
Hi Bret,
You can achieve this by using the Client Script. The below code might help you.
Name: Category based on Assignment group
Table: Incident [incident]
UI Type: All
Type: onChange
Field Name: Assignment group
Script:
If the answer has helped you, please mark the answer as correct/helpful.
Regards,
Sanjeeva.Y.Reddy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 03:34 PM
Please try with your keyword, as for my testing I used the 'Studio' keyword.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 04:59 PM
Hi @Bret Smith ,
Please modify the below script according to your field names:
Script include:
var GetUserGroup = Class.create();
GetUserGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isGrpMember:function() {
var gr = new GlideRecord('sys_user_grmember');
var usrName = this.getParameter('sysparm_username');
var grpName = this.getParameter('sysparm_groupName');
gr.addQuery('user',usrName);
gr.addQuery('group',grpName);
gr.query();
if(gr.next()) {
gs.log('JC: match');
return true;
}
else {
gs.log('JC: no match');
return false;
}
},
type: 'GetUserGroup'
});
Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('GetUserGroup');
ga.addParam('sysparm_name', 'isGrpMember');
ga.addParam('sysparm_username', newValue);
ga.addParam('sysparm_groupName','287ebd7da1fe198100f92cc8d1d2154e');
ga.getXML(hideField);
function hideField(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer == "false") {
g_form.removeOption('team_selection', '2');
}
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
