Client scripting: disable options from a dropdown

(courtesy of ServiceNow Guru:
https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-options/
)



//--remove the state options from the dropdown
    var control = g_form.getControl('state');
    var options = control.options;
    for (var i = 0; i < options.length; i++) {
        var option = options[i];
        var ov=option.value;
       
        if (ov!='-24') {
            control.options[i].disabled = 'true';
        }
       
    }

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue