Can't be an "=" sign in email subject line

Abbottronix
Tera Guru

I need to add '[SEC=OFFICIAL]' to all our email subject lines, but after doing so, they all cut off at '[SEC'. I realised that adding an '=' sign to an email subject eliminates the '=' sign and anything that comes after it. Is there anyway to include '=' in the email subject without this happening? 

1 ACCEPTED SOLUTION

Sanket Landge
Tera Expert

Hello @Abbottronix ,

 

Create a Notification Email Script and set the subject using email script in notification.

email.subject = "[SEC=OFFICIAL]".

 

 

Emails -> Notification Email script.

Use following syntax to call the email script in notification body
${mail_script:NameOfMailScriptHere}
  

 

Thanks,

Sanket Landge

View solution in original post

8 REPLIES 8

vijayr2313
Tera Contributor

you can add the '=' sign in your email notification subject line.. please check the length of the words updated in subject line, it shouldn't cross 100 words.

vijayr2313_0-1717562829394.png

 

If I add the = sign to the front of the subject line it still makes everything in the subject line disappear 

Vaishnavi Lathk
Mega Sage
Mega Sage
Hello,
In ServiceNow, you can achieve this by encoding the '=' sign in the subject line. ServiceNow supports URL encoding, so you can encode the '=' sign as '%3D'. Here's how you can do it:
// Assuming 'current' is the GlideRecord object representing the email record
var subject = current.subject.toString(); // Convert subject to string
subject = subject.replace('[SEC', '[SEC%3D'); // Replace '=' with '%3D'
current.subject = subject; // Update the subject in the email record
current.update(); // Save the changes

This script will replace '=' with '%3D' in the subject line before updating the email record. This way, the '=' sign won't get eliminated, and your subject lines will remain intact.

 

Regards,

Vaishnavi Lathkar

Hi Vaishnavi,

 

Is this code meant to go inside an email script?

 

Cheers