UI page script issue

Ketan Pandey
Tera Expert

HI Experts,

 

I have developed an UI Page,UI Page is having the bellow code 

 

 

<g2:evaluate  var="jvar_incidentGR jelly="true">

 

var incidentGR=new GlideRecord("incident");

incidentGR.addQuery('active','true');

incidentGR.query();

if(IncidentGR.next())

{

return incidentGR;

}

incidentGR;

}

<j:if test="$[incidentGR.hadNext()]">

<table>

 <j:while test="$[incidentGR.hadNext()">

<tr>

       <td> $[incidentGR.number </td>

</tr>

</table>

</g2:evaluate>

 

Its not working ,Please correct my understanding that ,<g> will execute first then <g2> and then <j> thn<j2>

 

how to access pahse 2 valirable 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Ketan Pandey 

your script is wrong.

Please update as this

<g2:evaluate  var="jvar_incidentGR" jelly="true" object="true">
		var incidentGR=new GlideRecord("incident");
		incidentGR.addActiveQuery();
		incidentGR.setLimit(1);
		incidentGR.query();
	</g2:evaluate>

	<j2:if test="$[incidentGR.hasNext()]">
		<table>
			<tr>
				<td> $[incidentGR.number </td>
			</tr>
		</table>
	</j2:if>

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Prince Arora
Tera Sage
Tera Sage

@Ketan Pandey 

 

Can you try this updated script and let me know (I haven't tested it)

 

<g2:evaluate var="incidentGR" jelly="true"> 

var incidentGR = new GlideRecord("incident");

incidentGR.addQuery('active', 'true');

incidentGR.query();

incidentGR;

</g2:evaluate>

<j:if test="$[incidentGR.hasNext()]">

<table>

<j:while test="$[incidentGR.next()]">

<tr>

<td>$[incidentGR.number]</td>

</tr>

</j:while>

</table>

</j:if>


 

Please accept the answer if it works for you!

Ankur Bawiskar
Tera Patron
Tera Patron

@Ketan Pandey 

your script is wrong.

Please update as this

<g2:evaluate  var="jvar_incidentGR" jelly="true" object="true">
		var incidentGR=new GlideRecord("incident");
		incidentGR.addActiveQuery();
		incidentGR.setLimit(1);
		incidentGR.query();
	</g2:evaluate>

	<j2:if test="$[incidentGR.hasNext()]">
		<table>
			<tr>
				<td> $[incidentGR.number </td>
			</tr>
		</table>
	</j2:if>

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank You Ankur this helped