- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
12-30-2021 03:18 AM - edited 10-11-2022 02:30 AM
Hi All,
Hope you are doing fine.
In this tutorial we will be looking into a basic question on ServiceNow glideRecord i.e. what is the difference between initialize and new record in ServiceNow.
First we will try to understand what is ServiceNow glideRecord ?
The GlideRecord class is the way to interact with the ServiceNow database from a script. See the GlideRecord API reference for a complete list of methods.
GlideRecord interactions start with a database query. The generalized strategy is:
– Create a GlideRecord object for the table of interest.
– Build the query condition(s).
– Execute the query.
– Apply script logic to the records returned in the GlideRecord object.
Here is what the generalized strategy looks like in pseudo-code:
// 1. Create an object to store rows from a table
var myObj = new GlideRecord(‘table_name’);
// 2. Build query
myObj.addQuery(‘field_name’,’operator’,’value’);
myObj.addQuery(‘field_name’,’operator’,’value’);
// 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
}
What is servicenow gliderecord initialize ?
Creates an empty record within the current GlideRecord that is suitable for population before an insert.
What is servicenow gliderecord newRecord?
Creates a GlideRecord, sets the default values for the fields, and assigns a unique ID to the record.
Hope you like this video , please like follow and subscribe to get notifications about new videos in future.
Regards,
Amit Gujarathi
(Technomonk)
- 9,965 Views