
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2025 05:38 PM
I have an integer field on the sys_user table called "u_queue_number".
What I want to do if possible via a flow is to seek out all records where u_queue_number is not blank and find what the current highest value of that field is and also how many records current have that value.
Ideas?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2025 08:01 PM
I understand that it would likely need to be done via a flow script, but was hoping someone might be able to assist with the how.
Since I posted my question I have managed to make it work, but just not sure it's the best way to do it?
Ultimately, I created a flow variable called "Highest Queue Number" then did a scripted date
var largestQueueNumber = 0;
var userGR = new GlideRecord('sys_user');
userGR.addQuery('u_queue_number', '!=', '');
userGR.query();
while (userGR.next()) {
var currentQueueNumber = parseInt(userGR.u_queue_number, 10);
if (!isNaN(currentQueueNumber) && currentQueueNumber > largestQueueNumber) {
largestQueueNumber = currentQueueNumber;
}
}
return largestQueueNumber;
Result:
So it works, but is it the best way?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2025 08:59 PM
I like the idea of improving the script to limit the database calls, however when I tried this in a flow I got the following error:
Invalid integer value for flow variable='null': {highestQueueNumber=5.0, countOfHighest=0}
The script is running in a set flow variables script