Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how to add workNotes for Group table.

Suresh_32
Tera Expert

We need to add work notes section in Group table . if any user add/remove from group, then work notes should be updated. 

 

please help me on this.

2 REPLIES 2

sujitha16
Kilo Patron

@Suresh_32 Below is the implementation for adding the worknotes using flow when an user(s) are added to the group. 

 

SujathaVM_0-1735044642660.png

SujathaVM_1-1735044707819.png

 

Each time when a user is added to a group, messages gets updated on the group record. 

SujathaVM_2-1735044776773.png

 

For removal of the user record update, there is delete operation that happens on the users related lists and the record details are tracked under "Deleted Record" table, but its an audit table which is not advised to be queried due to performance impact.

 

Alternatively, you may use event action on the business rule to trigger a notification for tracking or have custom table to track the details by inserting it as new record. 

 

Note : Above implementation technique/approach is only a suggestion. 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Rairai31
Giga Guru

This is a solution provided by ServiceNow support:

1) Add a journal type field to sys_user_group table (for example, u_work_notes)

2) Include the field (u_work_notes) in the system property=glide.ui.sys_user_group_activity.fields

3) Create a after insert Business Rule on sys_user_grmember with this script:

(function executeRule(current, previous /* null when async */) {

  gs.log('cf123 group is ' + current.getValue('group') + ' user is ' + current.getValue('user'));

  var parentRec = new GlideRecord('sys_user_group');
  if (parentRec.get(current.getValue('group'))) {

    gs.log('cf1234 group name is ' + parentRec.getDisplayValue('name'));

    parentRec.u_work_notes = 'User ' + current.getDisplayValue('user') + ' added.';
    parentRec.update();
  }

})(current, previous);