GlideRecord in servicenow examples
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2022 08:54 PM
what is Glide Record with examples
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2022 09:06 PM
Hi
The GlideRecord class is the way to interact with the ServiceNow database from a script.
You can do the below database operations using GlideRecord()
1.) Insert
2.) Update
3.) Delete
4.) Retrieval
Below is the example of retrieving the record information
For reference - https://developer.servicenow.com/dev.do#!/learn/learning-plans/quebec/new_to_servicenow/app_store_le...
https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/c_GlideRecordScopedAPI
// 1. Create an object to store rows from a table
var myObj = new GlideRecord('incident');
// 2. Build query
myObj.addQuery('active', true);
// 3. Execute query
myObj.query();
// 4. Process returned records
while(myObj.next()){
//Logic you want to execute.
//Use myObj.field_name to reference record fields
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2022 11:31 PM
Hi,
The developer docs can help:
https://developer.servicenow.com/dev.do#!/learn/learning-plans/rome/servicenow_application_developer/app_store_learnv2_scripting_rome_gliderecord
Also check this out:
https://servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
Geoff