- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 10:02 AM
if user updates worknotes of problem task then worknotes of incident should get updated using bsuiness rule
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 11:20 AM
@Priti18 You can achieve this functionality by creating an onBefore Update business rule on Problem Task table as follows.
Here is the script for the business rule.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (current.problem) {
var incidentRec = new GlideRecord('incident');
incidentRec.addQuery('problem_id',current.problem);
incidentRec.query();
while(incidentRec.next()){
incidentRec.work_notes = current.work_notes.getJournalEntry(1);
incidentRec.update();
}
}
})(current, previous);
Please mark this answer helpful and correct if it addresses your requirement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 11:20 AM
@Priti18 You can achieve this functionality by creating an onBefore Update business rule on Problem Task table as follows.
Here is the script for the business rule.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (current.problem) {
var incidentRec = new GlideRecord('incident');
incidentRec.addQuery('problem_id',current.problem);
incidentRec.query();
while(incidentRec.next()){
incidentRec.work_notes = current.work_notes.getJournalEntry(1);
incidentRec.update();
}
}
})(current, previous);
Please mark this answer helpful and correct if it addresses your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 11:56 AM
can you please explain your script and why before update because I created my Br on after update

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 08:21 PM
@Priti18 The business rule I have shared runs on Problem Task table it is an OnBefore Update business rule, you can change it to onAfter as well. The filter condition work_notes changes have been applied to only execute the script only when the work notes on the problem task is added. Inside if I am fetching all those incidents which have been originated from the problem record which is similar to the problem record on the problem task.
Finally I am adding the worknotes added on the problem task to the incident records.
Hope this helps.
Inside the script, I am checking if the problem task has an associated problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2023 03:38 AM
I am wanting the incident to update when the work notes in the Problem ticket PRB is updated. I attempted this Business rule but did not work. I changed the table to Problem. Dont know much about scripting but I assume it should have still worked with the current script