email notification to Users added or removed in OOTB field additional_assignee_list of pm_project

silviocrive
Tera Contributor

Hi All,

I need to send email notification to Users added or removed in OOTB field additional_assignee_list of the pm_project table.

This is not OOTB capability, I would like to attend ServiceNow recommendations avoiding custumization.

 

3 REPLIES 3

Huynh Loc
Mega Sage

To send email notifications when users are added or removed in the additional_assignee_list field on the pm_project table without heavy customization, follow these  steps:

-  Create a Business Rule to Detect Changes

  • Table: pm_project
  • When: Before or After update
  • Condition: current.isUpdatedField('additional_assignee_list')

Example code :

(function executeRule(current, previous /*null for before insert*/) {
  if (current.isUpdatedField('additional_assignee_list')) {
    var oldList = previous.getValue('additional_assignee_list') || '';
    var newList = current.getValue('additional_assignee_list') || '';
    var oldUsers = oldList.split(',');
    var newUsers = newList.split(',');

 

    var added = newUsers.filter(u => oldUsers.indexOf(u) === -1);
    var removed = oldUsers.filter(u => newUsers.indexOf(u) === -1);

 

    g_scratchpad.added = added.join(',');
    g_scratchpad.removed = removed.join(',');
gs.eventQueue('project.additional_assignee.changed', current, g_scratchpad.added, g_scratchpad.removed);
  }
})(current, previous);



Create Event & Notification

  1. Define an Event:

    • Name: project.additional_assignee.changed
    • Table: pm_project
  2. Create an Email Notification:

    • When to send: Event is fired
    • Event name: project.additional_assignee.changed
    • Who will receive: Use event.parm1 and/or parm2 or define logic in the Business Rule
    • Customize your email using ${event.parm1} and ${event.parm2} data pills

 

A similar use case and recommended approach is discussed in the ServiceNow Community blog below. Please review it for additional context and validation:

https://www.servicenow.com/community/itsm-forum/sending-notifications-only-to-newly-added-users-in-q...

If this response was helpful, please consider marking it as Correct and Helpful. You may mark more than one reply as an accepted solution.



Tanushree Maiti
Kilo Patron

Hi @silviocrive 

 

Refer :  Sending Notifications Only to Newly Added Users in "Additional Assignee List" for Change Requests // same thing , you need to change the table 

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Saiprasad_V
Kilo Contributor

We can handle this without heavy customization by using Flow Designer, which is the recommended approach in ServiceNow.

We can create a flow on the pm_project table with a trigger on update and check if the Additional Assignee LIst  field changes. Then, we can identify who was added or removed and send email notifications accordingly using the Send Email action.