- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2019 08:12 AM
Scoped GlideRecord - addQuery(String name, Object value) The first parameter is the table
field name.
Scoped GlideRecord - get(Object name, Object value)The first parameter is the Name of the
instantiated GlideRecord column to search for the specified value parameter.
When I need to process records in a table I always use addQuery() to filter.
Is this Best Practice?
when should i use the get() method?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2019 08:41 AM
Yes you can use two parameters in the get method i.e get('sys_id', gs.getUserID()) but the get method will only return one record so if your result set will have more than one record user addQuery otherwise if you only need one record returned you can use get().
As I stated in my previous response use get() method when you only need a single record returned. That is when it would be the preferable method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 05:55 PM
Not it is not quicker. It is slower.
Internally the get method does not use setLimit(1) and returns all matching records.
So it is much faster to use query with setLimit instead of get.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 09:59 PM