we need to enable sn_cim_task table worknotes with sn_cim_register table, when we update in worknote

avinash1289
Tera Contributor

we need to enable sn_cim_task table worknotes with sn_cim_register table, when we update in worknotes in CIM task it should be update  in sn_cim_register table worknotes

1 REPLY 1

Naveen20
ServiceNow Employee

Try this by creating a Business Rule on the sn_cim_task table that copies work notes to the parent sn_cim_register record whenever they're updated.

Business Rule Configuration:

  • Table: sn_cim_task
  • When: After
  • Update: true
  • Condition: current.work_notes.changes()

Script:

(function executeRule(current, previous) {
    if (current.work_notes.changes()) {
        var register = new GlideRecord('sn_cim_register');
        if (register.get(current.parent)) { // adjust field name to your reference field to sn_cim_register
            register.work_notes = current.work_notes.getJournalEntry(1);
            register.update();
        }
    }
})(current, previous);

Key points:

  • getJournalEntry(1) fetches only the latest work note entry, avoiding duplicating the entire history.
  • Replace current.parent with whatever reference field links your CIM task to the CIM register record (e.g., current.cim_register, current.u_register, etc.). Check your schema to confirm the exact field name.
  • If this is a scoped app table, make sure the Business Rule runs in the correct scope and has cross-scope access if needed.

If you also need the reverse sync (register → task), create a similar Business Rule on sn_cim_register targeting the related tasks.