How to allow spaces before and after email IDs using regex expression?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 08:24 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2025 03:50 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader