Email Notification Action Override

dbaril
Tera Expert

I have an e-mail notification setup based on the sc_request table. The default value in the User_Field is to send the email to u_customer. For specific requested items I would like to override this field via script to send to requested_for. I see that I can get access to the user_field value via the email_action object. I have tried to override the value as follows, but it had no effect.

email_action.user_field = 'requested_for';

Please let me know how to override this action.

Thank you,
Don

4 REPLIES 4

ravi154
Giga Contributor

u can have a go from this i guess : https://wiki.servicenow.com/index.php?title=Scripting_for_Email_Notifications


I did come across that article, however it only shows how to add "cc" and "bcc" recipients. According to the documentation the "addAddress" method does not accept a type value of "to".

addAddress(String type, String address, String displayname) - type can be "cc" or "bcc"

I need to override the "to" address, however there is no "setTo" method. I also tried the "setReplyTo" method but that did not work either.




ravi154
Giga Contributor

well i tried that method for one of my work and it did work - so if possible cud u share the code


I have the user_field set to "u_customer", I want to override it to be "requested_for". I have tried the following two statements but neither work.

email_action.user_field = 'requested_for';
email.setReplyTo(current.requested_for.email);

Would you share the code you used to get it to work.