how insert an incident using background script with impact and urgency

hemanthkumar
Kilo Expert

how insert an incident using background script with impact and urgency

3 REPLIES 3

Alikutty A
Tera Sage

You can try this in a background script



var inc = new GlideRecord('incident');


inc.initialize();


inc.caller_id = gs.getUserID();


inc.short_description = 'test';


inc.impact =3;


inc.urgency =3;


inc.insert();



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response


Hi Hemanth,



Adding to what Alikutty says,



var inc = new GlideRecord('incident');


inc.initialize();


inc.short_description = 'test';


inc.description = 'test';


inc.impact =3;


inc.urgency =3;


inc.insert();



description is   mandatory field most of the times.



Regards,
Shariq


Ankit_Pandey
Tera Contributor

Hi Hemanath,

 

inc.initialize();

 

var inc=new GlideRecord('incident');


inc.setValue('short_description', 'This incident is generated by Script');


inc.setValue('caller_id',gs.getUserID());


inc.insert();

 

Please find below the query for incident creation.

 

1. You can use this query in the fix script to insert it manually.

2. Also you can use it in scheduled jobs scripts to insert the incident at any particular time.