- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 11:59 AM
Is it possible to create a report that pulls random cases/requests based on the assigned to?
Or how could I create a page or module that would pull a random list of records based on the assigned to in a scoped application?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 12:48 PM
I found the following solution on another community post.
Create a UI Page:
[CODE]
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
window.onload = function() {
randomCase();
};
</script>
</j:jelly>
[/CODE]
Client Script:
[CODE]
function randomCase(){
var caseList = [];
var rec = new GlideRecord('table');
rec.addQuery('active', true);
rec.addQuery('investigator', 'IN', 'Name1,Name2,Name3,Name4');
rec.query();
while (rec.next()){
caseList.push(rec.getValue('number'));
}
var random = Math.floor((Math.random() * caseList.length));
var selected = caseList[random];
var txt = selected;
window.location = ("https://instance.service-now.com/nav_to.do?uri=x_whba_table.do?sysparm_query=number=" + selected);
}
[/CODE]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 01:46 PM
Hi Kaniel - I've written a blog on And the winner is... Randomly Selecting GlideRecords, which shows how to select a set of random records using a Scripted Filter.
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 05:21 AM
There is a Glide API to receive random data. Check this out:
The DevTools app contains a truckload of reusable scripts and
features to support your app development.
Fork at will!