Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

script is not working

chandanpatra
Tera Contributor

Hi All,

 

var matchFound = false;
var queueId = $sp.getParameter('location_id'); // Get current location ID
var gr = new GlideRecord('wu_location_queue');
gr.addQuery('sys_id',queueId);
gr.query();
if(gr.next())
{
var gr1= gr.name;
if (gr1.startsWith("Ben"))
{
matchFound= true
gs.addInfoMessage('test');
}
else
matchFound= false
gs.addInfoMessage('test123');

}

 

It is giving bothe alert while choosing Bengaluru location .

 

Can you help me   

1 ACCEPTED SOLUTION

Shruti
Mega Sage
Mega Sage
var matchFound = false;
var queueId = $sp.getParameter('location_id'); // Get current location ID
var gr = new GlideRecord('wu_location_queue');
gr.addQuery('sys_id', queueId);
gr.query();
if (gr.next()) {
    var gr1 = gr.name;
    if (gr1.startsWith("Ben")) {
        matchFound = true;
        gs.addInfoMessage('test');
    } else {
        matchFound = false;
        gs.addInfoMessage('test123');

    }
}

View solution in original post

1 REPLY 1

Shruti
Mega Sage
Mega Sage
var matchFound = false;
var queueId = $sp.getParameter('location_id'); // Get current location ID
var gr = new GlideRecord('wu_location_queue');
gr.addQuery('sys_id', queueId);
gr.query();
if (gr.next()) {
    var gr1 = gr.name;
    if (gr1.startsWith("Ben")) {
        matchFound = true;
        gs.addInfoMessage('test');
    } else {
        matchFound = false;
        gs.addInfoMessage('test123');

    }
}