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

it didnot trigger the email to the logged in user

as the gs.getUsedId() displays 'system'

 

just to add

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

 

with this the logs are printing correct but the mail is not triggered in email logs..

Hi Abhinab,

So you are getting user_name using event.user_name

Is it not setting the copied recipients on emails?

Did you try with hardcoded user name and email there

Regards
Ankur

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

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

Hi Abhinab,

so even hard-coded cc user not worked but email triggered with correct recipients?

Is your mail script in scoped app?

Can you try this?

email.addAddress("cc",user.email.toString(),user.getDisplayValue());

Regards
Ankur

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

No i mean it worked as per the email, i think even it worked from beginning , but for CC there is not separate email logs its the same email and included in CC