We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to getValue of multiple choice field in client script

Ankita9793
Tera Contributor

Hi All,


How to getvalue of a multiple choice field in client script? I tried using getvalue/ getDisplayValue but it doesn't work.
Please refer below client script and screenshots. TIA!!

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ipAddresses = g_form.getValue('enter_ip_addresses');
    var type = g_form.getValue('smtp_relay_authentication_type');
    var t = g_form.getDisplayValue('smtp_relay_authentication_type');

    alert('type', + t + type + g_form.getDisplayValue('smtp_relay_authentication_type'));


Capture.PNGCapture1.PNG 

 
1 ACCEPTED SOLUTION

Shruti
Giga Sage

Hi,

Ensure that you concatenate the strings and variables correctly within the alert function.The "+" operator should be used without a comma.

alert('type' + t + type + g_form.getValue('smtp_relay_authentication_type'));

View solution in original post

1 REPLY 1

Shruti
Giga Sage

Hi,

Ensure that you concatenate the strings and variables correctly within the alert function.The "+" operator should be used without a comma.

alert('type' + t + type + g_form.getValue('smtp_relay_authentication_type'));