The CreatorCon Call for Content is officially open! Get started here.

list collector to show display message

ServiceNow Use6
Tera Guru

Hi,

I have a list collector variable, and I have to display a message every time, we select a value. For one value selection, it is displaying the message not displaying if I select more than one message. Kindly help.

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }


var new_Variable = g_form.getDisplayValue('application');

if(new_Variable == 'Chexar'){
	
	g_form.showFieldMsg('application',"Used to assist customers with questions involving ATM Check Cashing.", 'info', false);
}
	else if (new_Variable == 'IVFR'){
		g_form.showFieldMsg("application", "Grants override access to IVFR for Contact Center associates only.", "info", false);
	}
		else if (new_Variable == 'TransPerfect'){
		g_form.showFieldMsg("application", "Provide Interpreters to assist Contact Center agents.", "info", false);
	}
	else if (new_Variable == 'SpeedPay'){
		g_form.showFieldMsg("application", "Used to make payment from another financial institution.", "info", false);
	}
	else if (new_Variable == 'VerID'){
		g_form.showFieldMsg("application", "Program that provide questions to be ask of customer to help verify identity.", "info", false);
	}
	
}

 

onChange.PNG

 

Regards

Suman P.

7 REPLIES 7

@ServiceNow Use6  did it help or did not help ?

Hi @Mohith Devatte ,

It did not work. It is showing only first message even now.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }


    var new_Variable = g_form.getDisplayValue('application').split(',');
	
    for (var i = 0; i < new_Variable.length; i++) {

        if (new_Variable[i] == 'Chexar') {
			g_form.addInfoMessage("Used to assist customers with questions involving ATM Check Cashing.");
           // g_form.showFieldMsg('application', "Used to assist customers with questions involving ATM Check Cashing.", 'info', false);
        }

        if (new_Variable[i] == 'IVFR') {
			g_form.addInfoMessage("Grants override access to IVFR for Contact Center associates only.");
           // g_form.showFieldMsg("application", "Grants override access to IVFR for Contact Center associates only.", "info", false);
        }

        if (new_Variable[i] == 'TransPerfect') {
			g_form.addInfoMessage("Provide Interpreters to assist Contact Center agents.");
          //  g_form.showFieldMsg("application", "Provide Interpreters to assist Contact Center agents.", "info", false);
        }

        if (new_Variable[i] == 'SpeedPay') {
			g_form.addInfoMessage("Used to make payment from another financial institution.");
           // g_form.showFieldMsg("application", "Used to make payment from another financial institution.", "info", false);
        }

        if (new_Variable[i] == 'VerID') {
			g_form.addInfoMessage("Program that provide questions to be ask of customer to help verify identity.");
         //   g_form.showFieldMsg("application", "Program that provide questions to be ask of customer to help verify identity.", "info", false);
        }
    }
}

 

Regards

Suman P.

 

Aman Kumar S
Kilo Patron

Hi @ServiceNow Use6 ,

Did you try using the alert why it is not working as expected, when you enter multiple value, it becomes an array, so instead of using the "==" operator, try using indexOf or contains function.

For example:

if(new_Variable.indexOf('Chexar') > -1){
	g_form.showFieldMsg('application',"Used to assist customers with questions involving ATM Check Cashing.", 'info', false);
}

 

Best Regards
Aman Kumar