Restrict Channel choices in incident form for specific assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 05:14 AM
Hi Everyone,
Just had a question I was hoping to get some guidance on ServiceNow environment.
I have a case that we need to restrict the choices in Channel field in incident form to specific assignment group.
For example: Group ABCD can only select Chat in Channel field.
Is there any documentation that can help me to achieve this.
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 07:42 AM - edited 11-03-2024 10:17 AM
Hi codi,
I don't have a 'Channel' choice field on the incident table. But you can use a Client Script defined on the incident table, runs 'onLoad' and has script logic like:
if (g_user.hasRole('ABCD')) {
g_form.removeOption('u_channel', 'value_1');
g_form.removeOption('u_channel', 'value_2');
// add more like the above.
}
Good luck. I found OOB example named "Restrict case types outside of CIs" defined on the 'sn_slm_case' table. The script there has:
function onLoad() {
g_form.removeOption('case_type', ''); // Removed --None-- from options
var isNewRecord = g_form.isNewRecord();
if (isNewRecord || (g_form.getValue('state') == '10')) {
g_form.removeOption('case_type', 'supplier_onboarding');
g_form.removeOption('case_type', 'request_supplier_contact');
g_form.removeOption('case_type', 'offboard_supplier_contact');
g_form.removeOption('case_type', 'primary_contact_elevation');
g_form.removeOption('case_type', 'invite_contact');
g_form.removeOption('case_type', 'elevate_or_restrict_access');
g_form.removeOption('case_type', 'document_change_request');
if (isNewRecord && (top.location.href).indexOf('case_type') == -1) // if no preset value from url
g_form.setValue('case_type', 'other');
if (!g_user.hasRole('sn_slm.owner')) {
g_form.removeOption('case_type', 'offboard_supplier');
}
}
}