BR that only runs when comments changes copy to task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 12:18 AM
How to create a BR that only runs when comments changes but state doesn't change. It should copy the comments to the task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 12:26 AM
Hi @Mounika30 your BR should be after update and condition must be
additionalcomment CHANGES // this would trigger only when comments are updated
and SCRIPT:
var task = new GlideRecord('sc_task');
task.addQuery('request_item',current.sys_id);
task.query();
while(task.next())
{
task.comments = current.comments.getJournalEntry(1);
task.update();
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:27 AM
Hi @Mounika30 Is your issue resolved. Please accept my solution if it helped you
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 12:52 AM
You can write Asynch -update business rule with below code:'
(function executeRule(current, previous /*null when async*/) {
// Check if the 'comments' field has changed
var commentsChanged = current.comments != previous.comments;
// Check if the 'state' field has remained the same
var stateRemainedSame = current.state == previous.state;
// Run the rule only when comments change but state remains the same
if (commentsChanged && stateRemainedSame) {
// Retrieve the associated task (e.g., Incident's parent task)
var task = new GlideRecord('task_table_name');
task.get(current.parent.sys_id); // Modify this to match your scenario
// Update the 'work_notes' field on the task with the comments from the current record
task.work_notes = current.comments;
task.update();
}
})(current, previous);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks