Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2019 10:56 PM
Hello all,
can anyone help me with the script of rest API to fetch the list of incident updated in last 5 min.
Thanks in advance.
Solved! Go to Solution.
Labels:
- Labels:
-
Incident Management
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2019 12:18 AM
10 REPLIES 10

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2019 05:48 AM
Hi Cinde,
Then you can try something like this.
Call REST API to fetch the records of last 15 minutes and then store that JSON in a result object.
//sample response
var result = '{"result":[{"number":"INC0010061","sys_updated_on":"2019-07-30 18:14:13"},{"number":"INC0010058","sys_updated_on":"2019-07-30 18:09:30"}]}';
var obj = JSON.parse(result);
var date1 = new Date();
date1.setMinutes(date1.getMinutes()-5);
for(i=0;i<obj.result.length;i++) {
var date = new Date(obj.result[i].sys_updated_on);
if(date1 < date) {
//use these incidents to show in app.
console.log("True"+obj.result[i].number);
}
}
Mark the comment as a correct answer and also helpful if it helps.