Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

In an inbound action, how do you write a regex for From: ?

e_wilber
Tera Guru

From an inbound action, how would you write an inbound action to look at every occurrence of From: in the email header and have those stored into an array?

We're looking at email.from in order to create new users and sometimes it's actually pulling from the wrong email header. I need a way to get an array of all the From: occurrences so I can do validation on them to see which one we should be using to create the user from.

1 REPLY 1

Community Alums
Not applicable

Hi @e_wilber ,

Can you please check the below script 

var regex = /[a-z][a-zA-Z0-9.-]{3,15}@[a-zA-Z0-9] {3,10}.(com|co.in)/;
         if (!regex.test(email)) {
g_form.showErrorBox('u_email_new', getMessage('Invalid Email ID'));
                 return false;
                 }

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak