ShowField Message for List Collector

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 08:05 PM - edited 09-01-2023 08:06 PM
Hi,
ShowFieldMessage for List Collector script always showing the first message. It is not entering the second If block at all. Kindly help.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var new_Variable = g_form.getDisplayValue('application').split(',');
alert("new variable " + new_Variable);
for (var i = 0; i < new_Variable.length; i++) {
// var new_Variable = g_form.getDisplayValue('application').split(',');
alert("new variable for " + new_Variable[i]);
if (new_Variable[i] == 'Chexar') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 08:26 PM
Hi @Community Alums
method getDisplayValue() for list collector fields doesn't work.
What you can do is using getValue()
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 08:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 09:34 PM
Hi @Community Alums
yes, that's correct, as this is how a list collector is storing references internally. In your code, you just have to replace the display names of your variables and use the sys id values instead. At the end, this is the better approach because your code will not break anymore after changing the display values of your variables.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 08:26 PM
Hi @Community Alums,
Script looks good to me. Make sure that the display values are correct and exact matching with if conditions.
Try this updated scripts. Added toString() before splitting by comma.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var new_Variable = g_form.getDisplayValue('application').toString().split(',');
alert("new variable " + new_Variable);
for (var i = 0; i < new_Variable.length; i++) {
// var new_Variable = g_form.getDisplayValue('application').split(',');
alert("new variable for " + new_Variable[i]);
if (new_Variable[i] == 'Chexar') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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') {
alert("if block 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);
}
}
}
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar