- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 06:35 AM
Hello everyone,
I am having issues getting my business rule to run where I want to have the change request fields of Assigned to and Configuration Item to flood from the change request to the change tasks. This is the script I am using.
(function executeRule(current, previous /*null when async*/) {
// Fetch the associated Change Request record
var changeRequest = new GlideRecord('change_request');
if (changeRequest.get(current.change_request)) {
// Set the assigned_to and configuration_item fields on the Change Task
current.assigned_to = changeRequest.assigned_to;
current.configuration_item = changeRequest.configuration_item;
}
})(current, previous);
Thank you for any help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 06:48 AM - edited 03-27-2024 06:49 AM
Hi @Justin Dirks1 your BR must be on change request table after insert or update
Script:
var chgTask= new GlideRecord('change_task'); chgTask.addQuery('change_request', current.sys_id);
chgTask.query();
while (chgTask.next()) { // Copy the Assigned To and Configuration Item from Change Request to Change Task
chgTask.assigned_to =current.assigned_to;
chgTask.cmdb_ci = current.cmdb_ci; chgTask.update();
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 06:48 AM - edited 03-27-2024 06:49 AM
Hi @Justin Dirks1 your BR must be on change request table after insert or update
Script:
var chgTask= new GlideRecord('change_task'); chgTask.addQuery('change_request', current.sys_id);
chgTask.query();
while (chgTask.next()) { // Copy the Assigned To and Configuration Item from Change Request to Change Task
chgTask.assigned_to =current.assigned_to;
chgTask.cmdb_ci = current.cmdb_ci; chgTask.update();
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 07:01 AM
That worked! Thank you so much!