How do I add stakeholders as recepients of an email notification when a project is updated or inserted?

Rick P
Kilo Contributor

Hi,

I'm trying to send a project status report to stakeholders who have a vested interest in the project.  I created an email notification using the Project [pm_project] table it sends a link to the Status Report to the user on update and insert.  I am able to add myself as a user and get the notification but cannot add stakeholders to the "Who will receive" because its not a field directly on the project but is only in the related lists section at the bottom of the project module. (It doesn't show as a field in "Users/Groups in fields" but when I do a Configure -> Related Lists on the project it shows there).  At least that is what I perceive to be the problem (I'm 3 weeks new to Servicenow).

I did see this post:

https://community.servicenow.com/community?id=community_question&sys_id=a83d07a9db9cdbc01dcaf3231f9619f8

Will this work for me?  Is there any way to get the stakeholders to appear in the "Who will receive"? 

 Any help is appreciated.

Thanks

This is my project (stakeholders is in a tab in the bottom section):

find_real_file.png

Here's the notification I set up:

find_real_file.png

 

1 ACCEPTED SOLUTION

Try doing this ...

var sh = new GlideRecord('pm_m2m_project_stakeholder');
sh.addQuery('project',current.sys_id);
sh.query();

while (sh.next()) {
email.addAddress('cc',sh.stakeholder.user.email);
}

View solution in original post

6 REPLIES 6

I wasn't able to get this to work. I get nothing back and null references when trying to expose the gliderecord properties.  My biggest hang up is that I don't have visibility into the gliderecord object.  I can't use gs.log and I can't use JSUtil because its a scoped app.  I can't install the xplore tool onto this instance.  I've tried to use gs.info but I just keep getting errors. I'm sure I just need to look into it more. Any other suggestions?  Thanks for your help

Thank you for your answer.  Just needed a toString() on the stakeholder emails.... smh
 
var sh = new GlideRecord('pm_m2m_project_stakeholder');
sh.addQuery('project',current.sys_id);
sh.query();
 
while (sh.next()) {
email.addAddress('cc',sh.stakeholder.user.email.toString());
}