The CreatorCon Call for Content is officially open! Get started here.

How to create a new incident using GlideRecord?

nirajjoshi
Tera Contributor
Run below code in All=> backgroup script
 
var incGr=new GlideRecord("incident");  //incGr is an incident table object created
incGr.newRecord();                                   //Creates new record in Incident Table
incGr.short_description="Test From Developer Course"; //entering the short description text here
incGr.urgency=3;                                     // assigning urgency as 3 i.e LOW
incGr.impact=2;                                      // assigning impact as 2 i.e Medium
incGr.assignment_group="d625dccec0a8016700a222a0f7900d06";  // assign sysid of assignment group here
var incSysid=incGr.insert();                   //this will insert the above values in a new incident
gs.print(incSysid);                                  // this displays the sysid of Incident
gs.print(incGr.number);                         // This displays the new incident number which we created
 
This will create new incident in incident table using GlideRecord
0 REPLIES 0