- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-22-2024 07:49 PM
Could you please suggest hoe to create a plan incident and incident task via script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-22-2024 08:07 PM
Below script will work to create a new incident and associate an incident task to it :
var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = 'Test Inc';
var inc_sys = inc.insert();
var incTask = new GlideRecord('incident_task');
incTask.initialize();
incTask.short_description = 'Test Inc Task';
incTask.parent = inc_sys;
incTask.incident = inc_sys;
incTask.insert();
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-22-2024 08:07 PM
Below script will work to create a new incident and associate an incident task to it :
var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = 'Test Inc';
var inc_sys = inc.insert();
var incTask = new GlideRecord('incident_task');
incTask.initialize();
incTask.short_description = 'Test Inc Task';
incTask.parent = inc_sys;
incTask.incident = inc_sys;
incTask.insert();
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-22-2024 09:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-22-2024 09:50 PM
Hi @Ketan Pandey ,
You can use this script
var gr = new GlideRecord('incident');
gr.initialize();
//gr.description = 'Testing';
//specify all details you want to fill in incident form using gr.field_name = 'value you want to insert';
gr.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â01-23-2024 03:29 AM
I respect the decision , but I am not in favour to use script if work can be done in LOW CODE / NO CODE. You can do via Flow designer
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]
****************************************************************************************************************