Email notification to CC current logged in user

Abhinab Achary1
Tera Guru

Hi All,

I am a bit stucked in mail notifcation.

I have a notification that send email to people when someone initiates transaction from UI action.

>I was solving using the 'event creator ' checkbox , strangely it dont work.. (Event triggered notification)

So lets say User A initiated and click button and now mail needs to go to User B and C 

with this check box on : it should trigger to B ,C and also to A(event creator).

 

>Another approach is i was the id of user to the mail script and use

(Event triggered notification)

call mail script for the mail notification 

So recipients are in Event.param2 and cc needs to be there from mail script as below

email.addAddress('cc', userEmai);

 

I cannot use last param of event as the CC or the fixed logged in user and content needs to be passed via that dynamically..

 

I don't know what I am doing wrong. similar situation worked well in past.

Thanks in Advance..

Abhinab

 

 

1 ACCEPTED SOLUTION

yes. even the hardcoded didnot work either.

 

The problem is may be it donot apear in email logs but mentioned in copied may be that is how it works and not come as a separate in email logs.

In my instance outgoing emails are blocked. 

find_real_file.png

View solution in original post

15 REPLIES 15

Hello Abhinab,

When the notification is triggered, check the logs and see if the notification is triggered to all recipients. If any of the recipient email address is blank or user is inactive/locked out then notification for that user will not be triggered, but you can see that in the logs.

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

It is triggered for all others 

Hi Abhinab,

So email is triggered for all recipients.

Is email not triggered to cc? Is that an issue?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes.. So the user that has triggered the email should come in CC for the same email that are triggered to the user 

Hi Abhinab,

So cc user is not set correctly? since you require cc to be set to the user who triggered you can use gs.getUserID()

Did you check this by adding logs?

event.user_id -> this comes to sys_id of the user or not

if nothing comes for this then use gs.getUserID()

var user = new GlideRecord('sys_user');
user.addQuery('sys_id',gs.getUserID());
user.query();
if(user.next()){
gs.log(user.email.toString()+user.name.toString(),'abhi6567');
email.addAddress("cc",user.email.toString(),user.name.toString());
}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader