Comments on: Returning Random Records Using GlideRecord https://servicenowguru.com/scripting/returning-random-records-gliderecord/ ServiceNow Consulting Scripting Administration Development Wed, 06 Mar 2024 22:17:46 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Daniel Oderbolz https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7410 Tue, 07 Nov 2017 07:59:12 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7410 In reply to Jim Pisello.

Dear Jim

Can you be a bit more specific on that?
I am having the problem that some script include that I call from a dynamic filter that used to run on Helsinki no longer runs on Istanbul.
(It runs just fine in a background script). I have a feeling, we have exactly this problem (that we call a function that is not allowed from a scoped application and somehow dynamic filters are now treated like a scoped application).
Service Now could not figure it out yet…

Best
Daniel

]]>
By: Daniel Oderbolz https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7409 Tue, 07 Nov 2017 07:56:34 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7409 Dear Mark,
this is cool code, thanks!
One small thing tough: I think you haven an off-by-1 isssue in the code.
You will have records from 0 to numRecs-1 and not to numRecs.
The problem is unlikely to occur (when the Random Number Generator returns 1), but I think you should account for it.

Best
Daniel

]]>
By: Jim Pisello https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7408 Fri, 14 Jul 2017 16:37:15 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7408 In reply to Tyrone.

Hi Tyrone,

There are several Glide methods that are not supported in Scoped Applications. You can learn more about APIs for scoped apps by going to https://developer.servicenow.com and clicking the API menu.

]]>
By: Tyrone https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7407 Thu, 18 May 2017 18:24:57 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7407 I am running this script in a scoped application and receiving the following: Function setLocation is not allowed in scope. Any Suggestions?

]]>
By: Mark Stanger https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7406 Mon, 31 Oct 2016 13:53:16 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7406 In reply to Stephanie.

That depends entirely on what you want to do with the output of the script. As a general rule, you would want to store the script in the place where you trigger the action for the script to execute. A business rule probably isn’t the right place for most use cases I can think of because that runs when a particular record is inserted or updated to the database. A scheduled job or something similar probably makes more sense but it really depends on what you are trying to accomplish.

]]>
By: Stephanie https://servicenowguru.com/scripting/returning-random-records-gliderecord/#comment-7405 Sat, 29 Oct 2016 12:30:54 +0000 https://servicenowguru.wpengine.com/?p=1983#comment-7405 Where would I put this script? I created a business rule on the cmdb_ci table but it doesn’t seem to do anything. I appreciate your help.

]]>