- 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 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:01 AM
Hello Ishaan, i am still not seeing an incident task populating the related incident task list. Not sure if its working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 11:04 AM
Actually, it looks like the incident task has actually been created when I navigate to 'incident_task.list' with the system navigator.
is there a way i could make it show up in the related lists section within the same incident form?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 11:04 AM
No worries, let me share a BR XML record for you.
BR.
Ishaan Shoor