We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

JakobAnkerN
ServiceNow Employee
Do you know what pain is?
Synchronizing additional comments and work notes across related records.
A real-life example is when you need to ensure that approvers, fulfillers, and service desk have the same information available to ensure that unnecessary business processes are kept to a minimum.

Many of you probably have tried to develop something yourselves, only to find that you have started a recursive loop-from-hell where a comment is passed back and forth between related records.

Here is a simple solution without additional field and field checks.

You should be able to do this both in a flow and in a business rule. I have included an example of a business rule configuration.

Make a business rule with the following condition

var comment = current.comments+""; comment.indexOf('<div style="display:none;">#synched#</div>') == -1

And the following script (introduces an invisible HTML tag that we can evaluate upon to avoid recursive updates)

var grSCTask = new GlideRecord("sc_task");
grSCTask.addQuery("request_item", current.getValue('sys_id'));
grSCTask.query();
while (grSCTask.next()) {
grSCTask.comments = current.comments + '[code<div style="display:none;">#synched#</div>[code]';
grSCTask.update();
}

Make a business rule like this on the related table; voila, you have 2-way synch.

12 Comments