We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

jelly syntax for less than or equal to

yundlu316
Kilo Guru

What is the correct syntax for less than or equal to in g:evaluate?   My code below doesn't seem to work and I couldn't find any documentation on Wiki regarding <=.

<g:evaluate var="jvar_high_priority">

var tasks = new GlideAggregate('u_tasks');

tasks.addQuery('assigned_to', gs.getUserID());

tasks.addQuery('state', 1);

tasks.addQuery('priority', '${AMP}lt=;', 3);

tasks.addAggregate('COUNT');

tasks.query();

var count = 0;

  if (tasks.next())

  count = tasks.getAggregate('COUNT');

</g:evaluate>

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Here you go



<g:evaluate var="jvar_high_priority">


var tasks = new GlideAggregate('u_tasks');


tasks.addQuery('assigned_to', gs.getUserID());


tasks.addQuery('state', 1);


tasks.addQuery('priority', 'IN', '1,2,3');


tasks.addAggregate('COUNT');


tasks.query();


var count = 0;


  if (tasks.next())


  count = tasks.getAggregate('COUNT');


count;


</g:evaluate>


View solution in original post

5 REPLIES 5

Sorry, that doesnt work either actually but this does



tasks.addQuery('priority', "&lt;=", 3);