copy additional comment & worknotes from incident to case .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 10:18 AM
how to copy the additional comments and worknotes from incident to related case record . i have already tried with the BR (before - update )
table- incident
(function executeRule(current, previous /*null when async*/ ) {
var relatedCase1 = new GlideRecord('sn_customerservice_case'); // initialize case table
relatedCase1.addQuery('incident', current.sys_id);
//relatedCase1.addActiveQuery();
relatedCase1.query();
if (relatedCase1.next()); {
relatedCase1.work_notes = current.work_notes;
//relatedCase1.update(); //updates changes
}
})(current, previous);
i have already tried to run the code but it is not working , i am a beginner , i dont know how to done programming properly , help me to find the solution so that i can understand easily.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 04:16 AM
Hi Lakshmi,
You need to add additional condition in BR to prevent it from copying recursively. Change variable names according to your requirement please.
current.comments.indexOf('Worknotes added from incident') < 0;
Copy task comments and worknotes to parent request item
Reference : Copy work notes/Additional comments from Incident to Incident task and vice versa
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***