gr.get() and gr.addQuery()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2021 12:27 AM
What is the use of gr.get() and gr.addQuery() ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2021 01:01 AM
Hi,
The ‘get’ method is a great way to return a single record when you know the sys_id of that record.
var gr = new GlideRecord('incident');
gr.get(sys_id_of_record_here);
//Do something with the record returned
if(gr.category == 'software'){
gs.log('Category is ' + gr.category);
}
The "addQuery" method will help you to add conditions on a query. Is like an "AND" condition. Practically, using this condition you will obtain a list of records which are complying to the condition.
You can read more about query and conditions here.
Please mark my response helpful and correct if solved your issue.
Cheers,
Ionut

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2021 01:01 AM
gr.get - Retrieve a specific record from GlideRecord Object
gr.addQuery - Build query to the GlideRecord Object
Refer the below URL for More details
Palani