Ryan Palamara
ServiceNow Employee
ServiceNow Employee

Work Notes Synchronization for Remote Task is not supported Out Of The Box (OOTB) in Service Bridge. However there are situations where Providers want to be able to synchronize "Work Notes" in addition to the OOTB sync of "Additional Comments". Here is an example on how this can be done with custom Business Rules (BR). As a customization, this falls outside of product support and you will be responsible for maintenance and troubleshooting, but if there is the business need, this will help get you started.

 

The first BR is to be created on the instance that will be sending the Work Notes. The BR will be created on the task table that is the source in the Remote Task Definition. For example, if you are syncing from Incident on the instance, that is the table the BR will target.

 

The instance that wants to send Work Notes from the parent record:

 

When: Before/Update

Table: Incident

Condition:

 

 

gs.isInteractive() && current.work_notes.changes()

 

 

 

Script:

 

 

//Get worknote and add User/Date/Time/TimeZone

var wn = current.work_notes + '\n\n-- ' + gs.getUserDisplayName() + '\n' + gs.nowDateTime() + ' ' + gs.getSysTimeZone();

//Get the Remote tasks if there are any for this parent

var rt = new GlideRecord('[sn_sb_remote_task]');

rt.addActiveQuery();
rt.addQuery('parent', current.sys_id+'');
rt.query();
while (rt.next()) {
     rt.work_notes = wn;
     rt.update();
}

 

 

 

The second BR will run on the destination instance and will target the Remote Task table. This BR is not specific to the destination table, so will only need to be created once, even if there are multiple destination tables.

 

The instance that wants to copy the inbound Work Notes from the Remote Task to their parent:

 

When: Before/Update

Table: Remote Task

Condition

 

 

current.work_notes.changes() && new sn_sb.SBTransportUtilBase().isTransporterUser(gs.getUserName())

 

 

 

Script:

 

 

if (current.parent) {        
var parent = current.parent.getRefRecord();        
parent.work_notes = current.work_notes + '';        
parent.update();
}

 

 

 

As always, be sure to test!

5 Comments