Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Restrict Channel choices in incident form for specific assignment group

Codi
Tera Contributor

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

1 REPLY 1

Bert_c1
Kilo Patron

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');
        }
    }
}