Skip to content

Commit 65603ae

Browse files
authored
Oder by Field
Codes for ordering records in ascending or descending order
1 parent 036d425 commit 65603ae

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Order By Scripts
2+
3+
This folder contains two JavaScript files that demonstrate sorting functionality.
4+
5+
## Files
6+
7+
- **orderByAscending.js** – Sorts data in ascending order.
8+
- **orderByDescending.js** – Sorts data in descending order.
9+
10+
## Usage
11+
12+
Include either script in your file and call the respective function to sort your table as needed.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function ascOrder(tableName, field) {
2+
var tableGr = new GlideRecord(tableName);
3+
tableGr.addActiveQuery();
4+
tableGr.orderBy(field);
5+
tableGr.query();
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function ascOrder(tableName, field) {
2+
var tableGr = new GlideRecord(tableName);
3+
tableGr.addActiveQuery();
4+
tableGr.orderByDesc(field);
5+
tableGr.query();
6+
}

0 commit comments

Comments
 (0)