GlideRecord - orderBy(String fieldName)

Specifies a field name to be used to order the query set. This may be called more than once to order by multiple fields.

Table 1. Parameters
Name Type Description
fieldName String A field name
Table 2. Returns
Type Description
void

Scoped equivalent

To use the orderBy() method in a scoped application, use the corresponding scoped method: Scoped GlideRecord - orderBy(String name).

function UpdateProjectWBS(project) {
  var count = 0;
  var child = new GlideRecord('pm_project_task');
  child.addQuery('parent', project.sys_id);
  child.orderBy('order');
  child.orderBy('number');
  child.query();
  var len = child.getRowCount().toString().length;
  var seq = 0;
  while (child.next()) {
    count += UpdateProjectTaskWBS(child, 1, ++seq, len, '');
  }
  gs.addInfoMessage(count + ' Project Tasks updated');
}