work notes from problem_task to problem is not working at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 02:06 AM
hi all ,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 02:24 AM
hi @tghadage124
Looks code is potentially causing a loop between the 'problem_task' and problem records. This could be happening because you're modifying the problem record's work notes in response to a change in the problem_task record, and that update might trigger an event that starts the process over again.
Could you try following code once :
var problemRec = new GlideRecord('problem');
problemRec.addQuery('sys_id', current.problem);
problemRec.query();
if (problemRec.next()) {
// Check if the work notes have already been updated to avoid recursion
if (!problemRec.u_processed) {
// Add the journal entry to work notes
problemRec.work_notes = current.work_notes.getJournalEntry(1);
// Set a flag to avoid recursion
problemRec.u_processed = true;
// Update the problem record
problemRec.update();
}
}
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 02:28 AM
Do you have Filter Conditions on the Business Rule when Work notes changes? Do you have any Business Rules running on the problem table that is doing anything with work_notes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 02:32 AM
Is there maybe a business rule that does the reverse: when the work notes on the problem are added, it copies those to all problem tasks?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 05:11 AM
Hi @tghadage124,
You can try the below code
BR: After update
Condition: work notes changes
table: problem_task
Script: