How to set the 'from' field in email notification

Averell
ServiceNow Employee
ServiceNow Employee

I've created a new table. When the state field changes to 'sent' an email should be sent. Everything works fine, but not the 'from'-email address.

I want to send out the email from the user who has updated the record. The reply address should be always the same.

In the 'What will it contain'   section of the definition in both the subject field and the message field the ${xyz} notation works, but not in the 'from' field. It looks the 'from' field is just a string field. No mechanism works on it to pass the required address ... Any idea?

1 ACCEPTED SOLUTION

Leave the from and reply to fields blank


Create a new 'Notification email script' say email_from having following code




email.setFrom(current.user.email);


email.setReplyTo(current.user.email);                                     //please review for backend name of updated by 'user' field




Now call this notification script from the notification's Message HTML field as follow


${mail_script:email_from}


View solution in original post

8 REPLIES 8

pardhu3
Giga Contributor

Hi,


when you are firing the event , you can pass the mail id of user who updated the record. and in the who will receive section select the param1 field.


regards,


Pardhu.


Gurpreet07
Mega Sage

check section   4.3 Overriding Email Fields


Scripting for Email Notifications - ServiceNow Wiki


Averell
ServiceNow Employee
ServiceNow Employee

ServiceNow.png


Averell
ServiceNow Employee
ServiceNow Employee

Hi Guys,


Thanks for your ideas. But my point is, I do not know how to enter this in the 'from' field. How to use this field? I have both information stored in two fields, the name and the email-address, but nothing works in this field ...