March 2017
Beginner
358 pages
9h 51m
English
orderBy() and orderByDesc() are both called in exactly the same way. Simply specify the field you'd like to sort the results by after your query is run:
var gr = new GlideRecord('incident'); gr.addQuery('active', 'true'); gr.orderBy('priority'); gr.query(); while (gr.next()) { //do something }
These APIs should be called prior to calling the query() method, as the database will sort the results before returning the query results to your script.
Read now
Unlock full access