GlideRecord - applyTemplate(String template)

Apply a template record (from sys_template) to the current record. If the specified template is not found, no action is taken.

Table 1. Parameters
Name Type Description
template String Name of a template from the sys_template table
Table 2. Returns
Type Description
void

Scoped equivalent

To replicate this functionality in a scoped application, parse the encodedQuery created by the template, then loop through the terms setting values on the GlideRecord.

var rec1 = new GlideRecord("incident");
rec1.initialize();
rec1.applyTemplate("my_incident_template");
//...possibly more code here... 

rec1.insert();