Auto delete incident task when selected affected location is de-selected onrelated list of incident
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 04:44 AM
Hi, I have a requirement whereend user select the affected location(cmn_location), incident task will be generated automatically through BR under the related list of incident. once incident task is closed complete, tax expense line(fm_expense_line) will be genaretd.Now, when user de-select the same affected location, it should delete already generated incident task also expense line so that sum of expense line will be calculated correctly.
BR: async ( insert - true)
table : affacted location
condition : task type is incident
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var incTask = new GlideRecord('incident_task');
incTask.initialize();
incTask.location = current.location.getValue();
incTask.incident = current.task.getValue();
incTask.short_description = 'Add Downtime to- ' + current.location.getDisplayValue();
incTask.assignment_group = current.task.assignment_group.getValue();
incTask.assigned_to = current.task.assigned_to.getValue();
incTask.cmdb_ci = current.task.cmdb_ci.getValue();
incTask.insert();
})(current, previous);
Any help on this really appreciated.
Thanks,
Abhishek
Labels:
- Labels:
-
Architect
0 REPLIES 0