- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 10:49 AM
Hey, I need to create an incident-task record in response to an incident being created with critical priority.
so far this is my script and it doesn't seem to be inserting anything into the related list of incident task.
(function executeRule(current, previous /*null when async*/ ) {
try {
var incidentTask = new GlideRecord('incident_task');
incidentTask.initialize();
incidentTask.short_description = 'This critical incident has been submitted involving your team member. Close this ask as a sign of acknowledgment';
incidentTask.parent = current.sys_id;
incidentTask.assigned_to = current.caller_id.manager;
incidentTask.incident = current.number;
incidentTask.insert();
} catch (error) {
gs.log(error + 'test');
}
})(current, previous);
Nothing is being populated here.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 10:56 AM - edited 11-28-2022 11:14 AM
Hi,
I've updated your script please try now.
(function executeRule(current, previous /*null when async*/ ) {
var incidentTask = new GlideRecord('incident_task');
incidentTask.initialize();
incidentTask.short_description = 'This critical incident has been submitted involving your team member. Close this ask as a sign of acknowledgment';
incidentTask.parent = current.sys_id;
incidentTask.assigned_to = current.caller_id.manager;
incidentTask.incident = current.sys_id;
incidentTask.insert();
})(current, previous);
.
BR.
Ishaan Shoor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 11:12 AM
Hi @kgomez222
Please find attached the Business rule XML record, do update your when to run and conditions in the BR.
BR.
Ishaan Shoor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 11:19 AM
Thank you ishaan! it works! appreciate the help