The Now Platform® Washington DC release is live. Watch now!
We all have to implement a requirement commonly where atleast one record/result exists before we do some processing. Example, a emergency change has atleast one incident attached to it before we allow the user to submit it. We have atleast 6 different ways to do this query (probably more) and find if atleast one such record exists.
Some of the ways are include,
There has been multiple discussion on the most optimal way to do this including the one here. But how do we know which is the best/fastest way to do this? Attached are different versions of the script, scanning the task table. The idea is to reproduce the results with the full table scan.
The winner of the test was Gliderecord + setLimit() + hasNext() function. Using setLimit seems to be the trick for getting most optimal performance possible.
Note: ServiceNow seems to be caching the records after the initial query. So, do few runs to determine the average performance of different function calls.
If you liked the content, please share, like, bookmark or leave your valuable comments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.