list collector to show display message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 04:42 AM
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);
}
}
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 04:46 AM - edited 09-01-2023 04:48 AM
Hello @ServiceNow Use6 ,
If multiple values are selected then list collector will return values in comma separated format.
so you need to loop in all the values like below
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.showFieldMsg('application',"Used to assist customers with questions involving ATM Check Cashing.", 'info', false);
return;
}
else if (new_Variable[i] == 'IVFR'){
g_form.showFieldMsg("application", "Grants override access to IVFR for Contact Center associates only.", "info", false);
return ;
}
else if (new_Variable[i] == 'TransPerfect'){
g_form.showFieldMsg("application", "Provide Interpreters to assist Contact Center agents.", "info", false);
return ;
}
else if (new_Variable[i] == 'SpeedPay'){
g_form.showFieldMsg("application", "Used to make payment from another financial institution.", "info", false);
return;
}
else if (new_Variable[i] == 'VerID'){
g_form.showFieldMsg("application", "Program that provide questions to be ask of customer to help verify identity.", "info", false);
return;
}
}
}
Hope this helps
Mark the answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 05:02 AM
Hi @Mohith Devatte ,
When I do this, the first message stays the same all the time, even though I select a couple of other values. How can I make it better?
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.showFieldMsg('application', "Used to assist customers with questions involving ATM Check Cashing.", 'info', false);
}
if (new_Variable[i] == 'IVFR') {
g_form.showFieldMsg("application", "Grants override access to IVFR for Contact Center associates only.", "info", false);
}
if (new_Variable[i] == 'TransPerfect') {
g_form.showFieldMsg("application", "Provide Interpreters to assist Contact Center agents.", "info", false);
}
if (new_Variable[i] == 'SpeedPay') {
g_form.showFieldMsg("application", "Used to make payment from another financial institution.", "info", false);
}
if (new_Variable[i] == 'VerID') {
g_form.showFieldMsg("application", "Program that provide questions to be ask of customer to help verify identity.", "info", false);
}
}
}
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 05:07 AM - edited 09-01-2023 05:07 AM
@ServiceNow Use6 i think its because of field message method where it might be a case where only one field message is shown.
Please try to use addInfomessage where it can accept multiple infos if it goes to multiple loops
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 05:16 AM