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

shyamkumar VK
Kilo Patron

@Talari Balateja ,

<mail_script>

 

email.setFrom("Display Name <adress @ company.com>");

</mail_script>



(Ensure without the spaces around the @ character)

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar