Skip to content

Commit d081098

Browse files
authored
Create fetchincidents.js
1 parent 4223c2b commit d081098

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var inc = new GlideRecord('incident');
2+
inc.orderByDesc('sys_created_on');
3+
inc.setLimit(15);
4+
inc.query();
5+
gs.info('Below are the 15 most recently created incidents along with their Assigned status: ');
6+
while (inc.next()) {
7+
var assignedIncident = '';
8+
if (inc.assigned_to) {
9+
assignedIncidentStatus = 'Assigned';
10+
} else {
11+
assignedIncidentStatus = '**NOT Assigned**';
12+
}
13+
gs.info('Number: ' + inc.number + ', Created on: ' + inc.sys_created_on + ', ' + assignedIncidentStatus);
14+
}

0 commit comments

Comments
 (0)