Incident

P1234
Tera Contributor

Create incident and along with short-description & description using script?

5 REPLIES 5

OlaN
Giga Sage
Giga Sage

Hi,
This is a simple example of the script.

var incGR = new GlideRecord('incident');
incGR.newRecord();
incGR.setValue('short_description', 'Some text for short description');
incGR.setValue('description', 'Some text for a longer description here...');
incGR.update();

Ankur Bawiskar
Tera Patron
Tera Patron

@P1234 

so what did you start with and where are you stuck?

It's an easy requirement.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ehab Pilloor
Mega Sage

Hi @P1234

You can create Incidents and set description and short description using server side script. Following is the code snippet:

var incidentGR = new GlideRecord('incident');
incidentGR.initialize();
incidentGR.setValue('short_description', 'ADD_YOUR_SHORT_DESCRIPTION');
incidentGR.setValue('description', 'ADD_YOUR_DESCRIPTION');
incidentGR.insert();
gs.info(incidentGR.sys_id);

 

Regards,

Ehab Pilloor

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @P1234 

 

Try to keep it as low-code as possible.
You also didn’t mention how and from where you want to create the index.
Just writing one line won't help, mate. It’s actually quite simple—you can try it on your end as well.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************