Add secondary email address to user

rm2
Kilo Contributor

How to add secondary email address to the user table, as he needs email notification to be sent

or Can we add to the email script ?

 

7 REPLIES 7

Allen Andreas
Administrator
Administrator

Hello,

If you're in a situation where you need to list a second email address (this is common when working with acquisitions where there's email address "A" for the old company and email address "B" for the new company -- and you all haven't moved everything all the way over yet), you can create a custom secondary email field on the sys_user table and store the alternate values there. This could also be used with LDAP, etc. to store secondary email addresses for your users.

Then, when sending the notification, you'd select the user reference field as normal, but then also create a mail script to add their alternate email as a cc, such as:

var gr = new GlideRecord('sys_user');
gr.get(current.user_field);
email.addAddress('cc', gr.getValue('u_secondary_email'), gr.getValue('name'));

Then in the body of the notification, call the mail script like:

${mail_script:name_of_mail_script}

The above is an example, but hopefully you can take it from here.

  • Replace user_field with the name of the field on the current record that triggered the notification that has a reference to the sys_user table.
  • Replace u_secondary_email with the actual name of the custom field holding the secondary email address.
  • Replace name_of_mail_script with the actual name of the mail script you created.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I will definitely try this solution, but in case where multiple users want to have their multiple email ids added, not only one secondary email 

Is it possible to achieve through notification device?

cmn_notif_device

Hi @Allen Andreas ,
I have a similar use case to what you have explained, where we require to send email to both primary and secondary email addresses.

We have created a new email field on user table.

But, every system notification that is triggered to a user(email field on user table)  should be sent to both email addresses(primary and secondary)

The above solution you have suggested requires modifying the notification as well(adding mail script to the body which adds the secondary email to the cc)
Do you reckon there is any other way we could achieve a similar outcome but without having to modify every notification in the system(including OOB) to include secondary email addresses.

 

 

 


Any pointers are appreciated.

Thanks,
Zabeeulla