When Change is created by clicking on "Copy change" then add worknotes on new change with change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 06:12 PM
When Change is created by clicking on "Copy change" then add worknotes on new change with change number it was copied from.
I tried business rule below, dint work.
(function executeRule(current, previous /*null when async*/) {
// Check if the change request is created by copying from another change
if (current.changes_made == 'copied') {
// Add work notes to the new change request with the change number it was copied from
var workNotes = "This change request is copied from change " + current.copied_from.change_number;
current.work_notes = workNotes + "\n" + current.work_notes;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 06:58 PM
Hi @Samuel Penumaka ,
Refer this logic ;
https://www.servicenow.com/community/developer-forum/modifying-the-copy-change-ui-action/m-p/2130082
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 08:55 PM
HI @Samuel Penumaka ,
I trust you are doing great.
Please find the updated business rule as given below :
(function executeRule(current, previous /*null when async*/) {
// Check if the change request is created by copying from another change
if (current.changes_made == 'copied') {
// Add work notes to the new change request with the change number it was copied from
var copiedFrom = current.getValue('copied_from');
if (copiedFrom) {
var copiedFromChangeNumber = copiedFrom.getValue('change_number');
if (copiedFromChangeNumber) {
var workNotes = "This change request is copied from change " + copiedFromChangeNumber;
current.work_notes = workNotes + "\n" + current.work_notes;
}
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 09:39 PM
Hello Amit,
Unfortunatly, it dint work as expected.