create 5 incident tasks when a incident is create
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:44 PM
When category, subcategory, item , and summary are customer, capacity, no action taken, and customer it should automatically create 5 incident tasks.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 09:21 AM
Hi @Payal Tripathy ,
You can create a business rule (after) with your own conditions.
You can use the below script :
(function executeRule(current, previous /*null when async*/ ) {
var incidentGR = new GlideRecord("incident_task");
for (var i = 0; i < 5; i++) {
incidentGR.initialize();
incidentGR.incident = current.sys_id;
incidentGR.short_description = current.short_description;
incidentGR.description = current.description;
incidentGR.assignment_group = current.assignment_group;
incidentGR.assigned_to = current.assigned_to;
incidentGR.cmdb_ci = current.cmdb_ci;
incidentGR.insert();
}
})(current, previous);
If you find this helpful, Kindly accept this solution.
Thank you!
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 10:16 AM
Hi @Payal Tripathy ,
Please create Before Business Rule and add below code
var count = 5
gs.log("Inside BR");
var incTaskGR = new GlideRecord("incident_task");
for (var i = 0; i < count; i++) {
incTaskGR.initialize();
incTaskGR.incident = current.sys_id;
incTaskGR.cmdb_ci = current.cmdb_ci;
incTaskGR.description = current.description;
incTaskGR.short_description = current.short_description;
incTaskGR.assigned_to = current.assigned_to;
incTaskGR.assignment_group = current.assignment_group;
incTaskGR.assigned_to = current.assigned_to;
incTaskGR.insert();
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak