How to allow spaces before and after email IDs using regex expression?

Santhosh15
Tera Guru

Hello All,

 

I need some help from you.

I have a field called "u_email_addresses_for_targeted_email", I am adding some email id's with spaces and which is not sending emails whenever there is a space before or after the email id's.

 

Below is the script which is using in script include and calling on business rule.

 
parm4 = current.u_email_addresses_for_targeted_email.toString();
parm4 = parm4.replace( new RegExp( "[\r\n]", "gm" ), "," );
 
Please help me on this issue.
 
Thank you in Advance
 
 
10 REPLIES 10

@Santhosh15 

I already told the lines to update

parm4 = current.u_email_addresses_for_targeted_email.toString();
parm4 = parm4.replace(/\s/g, '');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader