Configuring notifications for multiple internal companies

Dubz
Mega Sage

Hi All,

My company is actually a group of operating companies, as such some entities within the group require their own branding on things like service portal and notifications. I'm dealing with notifications now and i'm wondering if there is a more elegant solution than just creating a load of duplicate notifications and just changing the logo and saying, send this one when the company is this or when this email address is contacted.

I'm thinking of a mail script that looks up the company related to the incident and says, 'you're company x therefore i will send the signature associated with company x and the from and reply to addresses will be those associated with company x'.

Has anyone else done anything similar to this? Any advice is welcome

1 ACCEPTED SOLUTION

Actually, just read this:



5 Mail Script API

The following variables are available when processing mail_script scripts.


VariableObject Description
templateHandles printing from the mail script to the email message.

template.print("message"); //outputs message to the email body.
template.space("number of spaces"); //outputs spaces to the email body.


email_actionGlideRecord object for the email notification (sysevent_email_action).
eventGlideRecord object for the event that fired the notification (sysevent).
emailEmailOutbound object

Available methods:


  • addAddress(String type, String address, String displayname): type can be cc or bcc.
  • setFrom(String address): override the sender address.
  • setReplyTo(String address): override the reply to address.
  • setSubject(String subject): override the subject of the message.
  • setBody(String message): override the body of the message.

The email address that is passed by setFrom and setReplyTo needs to be in a valid form such as 'helpdesk@sn.com' or 'Display Name <helpdesk@sn.com>'. If the email address includes a 'Display Name', then that value overrides the instance's display name.


Looks like setFrom and setReplyTo should fulfill my requirements!


View solution in original post

9 REPLIES 9

Actually, just read this:



5 Mail Script API

The following variables are available when processing mail_script scripts.


VariableObject Description
templateHandles printing from the mail script to the email message.

template.print("message"); //outputs message to the email body.
template.space("number of spaces"); //outputs spaces to the email body.


email_actionGlideRecord object for the email notification (sysevent_email_action).
eventGlideRecord object for the event that fired the notification (sysevent).
emailEmailOutbound object

Available methods:


  • addAddress(String type, String address, String displayname): type can be cc or bcc.
  • setFrom(String address): override the sender address.
  • setReplyTo(String address): override the reply to address.
  • setSubject(String subject): override the subject of the message.
  • setBody(String message): override the body of the message.

The email address that is passed by setFrom and setReplyTo needs to be in a valid form such as 'helpdesk@sn.com' or 'Display Name <helpdesk@sn.com>'. If the email address includes a 'Display Name', then that value overrides the instance's display name.


Looks like setFrom and setReplyTo should fulfill my requirements!


Claire13
Kilo Contributor

Hello,

Could you trigger a different notification based on service or service offering?

 

Thank you,

Claire

Hi Claire,

 

Yes, you can either generate different events in a business rule depending on the service or service offering on the form or you could build in some logic to a mail script to change the content of the email dynamically depending on the service or service offering.

 

Cheers

Dave

Hello,

 

Can you share the dynamic mail script that you created for this? I'm having a hard time writing out the logic of "If recipient's company = x, setFrom and setReplyTo = x"

The logic would be something like below

var gr = new GlideRecord('core_company');
if(gr.get(gs.getUser().getCompanyID())){
if(gr.getValue('name') == 'insert company name here'){
email.setFrom('Displayname<email@address.com>');
email.setReplyTo('Displayname<email@address.com>');
}
}

If you have a lot of companies you need to do this for it would probably be worth storing the details on the company form so you don't have to hardset the from/reply to address.