I written mail script to change display name for notification, but it's not working

Talari Balateja
Tera Expert

HI,

 

I written mail script to change display name for notification, but it's not working and showing display name.

 

 

SCRIPT:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
//Changing from display name
          email.setFrom("CyberSecurity CyberSecurity@XYZ.com");
 
})(current, template, email, email_action, event);

 

logs:

Date: Fri, 15 Mar 2024 03:03:56 -0700 (PDT)
From: IT Global Service Desk <CyberSecurity
CyberSecurity@xyz.com>
Reply-To: IT Global Service Desk <isupport@service-now.com>
To: receipient@xyz.com

 

 

Reagrds,

Sanju.

1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @Talari Balateja ,

 

Could you please try something like below,

 

 

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
//Changing from display name
          email.setFrom("CyberSecurity <CyberSecurity@XYZ.com>");
 
})(current, template, email, email_action, event);

 

 

 

 

If you want to use mail script, use the format below, and make sure From is blank in Notification
email.setFrom("TEST NAME <ab@gmail.com>");

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

5 REPLIES 5

AshishKM
Kilo Patron
Kilo Patron

Hi @Talari Balateja

 

Please check if the From field also configured for this email notification.

 

AshishKMishra_0-1710507795557.png

 

-Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM 

 

I have tried but still, I'm getting the same display name.

 

Regards,

Sanju.

Check the reply from  @swathisarang98 , if it works in your case, make sure the From field is empty.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

swathisarang98
Giga Sage
Giga Sage

Hi @Talari Balateja ,

 

Could you please try something like below,

 

 

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
//Changing from display name
          email.setFrom("CyberSecurity <CyberSecurity@XYZ.com>");
 
})(current, template, email, email_action, event);

 

 

 

 

If you want to use mail script, use the format below, and make sure From is blank in Notification
email.setFrom("TEST NAME <ab@gmail.com>");

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang