Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

include orderby in query business rule

srikanthvk
Giga Expert

Hi All,

I have been trying to include orderBy in my query business rule and somehow I'm unable to make it work.

Can someone guide if we can use orderBy in the query business rules?

Code Snippet:

var qc = current.addQuery('active','true').orderBy('state');

Thanks,

Srikanth Varma

10 REPLIES 10

pveg
Tera Contributor

It works perfectly when adding the ^ORDERBY or ^ORDERBYDESC to an encoded query as well. 

For example: current.addEncodedQuery('active=true^ORDERBYnumber');