- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2020 10:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2020 10:49 PM
Hey SS,
Query: Runs the query against the table,Issue the query to the database to get relevant records.
In order to query a table, first create a ServiceNow object for the table. This object is called a GlideRecord.
query() is a method of class 'GlideRecord'.
addQuery: Adds a filter to return records where the field meets the specified condition
Syntax: addQuery(String name, Object operator, Object value) //(field, operator, value).
Mark correct and helpful if it resolves your issue!!!
Best Regards,
Namrata.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2020 10:59 PM
Hi,
simply this is the difference
addQuery() ->
- is used to query against particular field of table;
- you can have multiple addQuery() statements to query against multiple fields
- it is not mandatory to use addQuery() everytime
query() ->
- once you define on which fields with what values you want to query you need to use this function to actually initiate a query to the database table to fetch the required records
- this is mandatory to use to perform the actual query
Sharing link for reference:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader