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:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 07:06 AM
Hi @Community Alums,
I did mistake. I forgot getDisplayValue() will not work for list collector field. It will give the display values for that record not to list collator selected values.
As @Maik Skoddow, already suggested, you should use the getValue() method and check the sys_id of selected values. The display-value might be changed in future but not sys_id.
Updated scripts:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var new_Variable = g_form.getValue('application').split(',');
alert("new variable " + new_Variable);
for (var i = 0; i < new_Variable.length; i++) {
alert("new variable for " + new_Variable[i]);
if (new_Variable[i] == 'Chexar_sys_id') {
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_sys_id') {
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_sys_id') {
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_sys_id') {
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 11:43 PM
Hi @Community Alums,
Have you looked into my comments? let me know if you have any queries.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 09:51 PM
Hi @Community Alums ,
If you are running your script for native portal, then you can try below code to get the display value.
For service portal you can use g_form.getDisplayValue() and for native portal you can use g_form,getDisplayBox()
var new_Variable = g_form.getDisplayBox('application').value;
If my answer solves your issue please mark it as Helpful 👍 and Accepted✔️ based on impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2023 08:06 AM
Hello @Community Alums ,
If we use g_form.getDisplayValue() in the client script it retrieves the value of the display field of that specific table if we're using this on the requested item table it will retrieve the value of the RITM number instead of a specific field. If
In your case, you need to update your code with getValue() to get the value of a specific filed in requested item, But the get value will return the sys_id of the actual record. You need to update actual value with sys_id like instead if 'Chexar' you have to add the sys_id of the question choice.
Kindly use the following code and just update the sys_id question choice where we added actual question choice display value.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var new_Variable = g_form.getValue('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] == 'add Sys_id of question choice chexar') {. // add Sys_id of question choice clear 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] == add Sys_id of question choice IVFR) { //add Sys_id of question choice 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] == add Sys_id of question choice Transperfect) { add Sys_id of question choice 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] == add Sys_id of question choice SpeedPay) { //add Sys_id of question choice 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] == 'add Sys_id of question choice VerID') { add Sys_id of question choice 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);
}
}
}
Please mark this as the correct answer and helpful if it is resolved, or mark this helpful if this helps you to reach towards solution.