- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 08:49 PM
Hi
Can any one guide me
how to copy worknotes and additional comments from workorder(FSM)
To its parent Service Request ticket and and then to the Case ticket
Please guide and help me with script.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 10:30 PM
HI @Research ,
I trust you are doing great.
Here's a basic outline for such a script in a business rule:
(function executeRule(current, previous /*null when async*/) {
// Assuming 'parent' is the reference field to the Service Request
var serviceRequestGR = new GlideRecord('service_request_table'); // Replace with your Service Request table name
if (serviceRequestGR.get(current.parent)) {
// Copy worknotes and additional comments
serviceRequestGR.work_notes = current.work_notes; // Adjust field names as necessary
serviceRequestGR.comments = current.comments; // Adjust field names as necessary
serviceRequestGR.update();
// If the Service Request is linked to a Case, repeat the process
var caseGR = new GlideRecord('case_table'); // Replace with your Case table name
if (caseGR.get(serviceRequestGR.parent)) { // Assuming the Case is linked in a similar way
caseGR.work_notes = current.work_notes;
caseGR.comments = current.comments;
caseGR.update();
}
}
})(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
12-03-2023 10:30 PM
HI @Research ,
I trust you are doing great.
Here's a basic outline for such a script in a business rule:
(function executeRule(current, previous /*null when async*/) {
// Assuming 'parent' is the reference field to the Service Request
var serviceRequestGR = new GlideRecord('service_request_table'); // Replace with your Service Request table name
if (serviceRequestGR.get(current.parent)) {
// Copy worknotes and additional comments
serviceRequestGR.work_notes = current.work_notes; // Adjust field names as necessary
serviceRequestGR.comments = current.comments; // Adjust field names as necessary
serviceRequestGR.update();
// If the Service Request is linked to a Case, repeat the process
var caseGR = new GlideRecord('case_table'); // Replace with your Case table name
if (caseGR.get(serviceRequestGR.parent)) { // Assuming the Case is linked in a similar way
caseGR.work_notes = current.work_notes;
caseGR.comments = current.comments;
caseGR.update();
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi