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

in server side update like below and try

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')

}

 

I am telling to that SErver side script is working fine but the HTML side is not working and we are receiving the data "c.data.matchfound " correct data

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

its failing because you retuning as string from server side and comparing as Boolean value.

 

Please update the 

data.matchfound=false

 

data.matchfound=true

it will work fine

 

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

 

It is not working 

it will be 

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