GlideRecord - insert()

Inserts a new record using the field values that have been set for the current record.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
String The sys_id of the inserted record, or null if the record is not inserted.

Scoped equivalent

To use the insert() method in a scoped application, use the corresponding scoped method: Scoped GlideRecord - insert().

var gr = new GlideRecord('to_do');
gr.initialize(); 
gr.name = 'first to do item'; 
gr.description = 'learn about GlideRecord'; 
gr.insert();