Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Portal script is not working properly

chandanpatra
Tera Contributor

Hi All , this script is not working properly :

 

HTML:

<div ng-if='c.data.matchfound' >
<p>Please select one of the service lounges below </p>
</div>

 

Server side:

var queueId = $sp.getParameter('location_id');

var gr3= new GlideRecord('wu_location_queue');
gr3.addQuery('sys_id',queueId);
gr3.addEncodedQuery('nameSTARTSWITHME^active=true');
gr3.query();
if(gr3.next())
{
data.matchfound='true';

gs.addInfoMessage('test')



}
else{
data.matchfound='false';
gs.addInfoMessage('fail')

}

 

In the HTML side it is not working fine 

1 ACCEPTED SOLUTION

it will be 

<div ng-if='c.data.matchfound' >
<p>Please select one of the service lounges below </p>
</div>

 

View solution in original post

9 REPLIES 9

Bhavya11
Kilo Patron
Kilo Patron

Hi @chandanpatra ,

 

is data is coming in $sp.getParameter('location_id');?.

 

Thanks,

BK

It is picking correct current location 

Hi @chandanpatra ,

 

For $sp.getParameter() you need to check the URL of the page to get valid parameter.

For example: /id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9 if you take this URL and use $sp.getParameter() you will get different results based on parameters you pass:

 

$sp.getParameter('id') this will return sc_cat_item

$sp.getParameter('sys_id') this will return 3f1dd0320a0a0b99000a53f7604a2ef9

 

 

Please check in server what value it returns.

 

Thanks

BK

Server side is working fine , but the HTML is not working , c.data.matchfound   I am getting correct answer