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.

Fetching First name and last Name from email ID

Savita P
Tera Contributor

How we can fetch first name, last name from email id and store it to fields?

Thanks.

1 ACCEPTED SOLUTION

Sample script:

var empMail = 'abhishek.gardade@company.co.in';

var fullName = empMail.split('@')[0].split('.');

var firstName = fullName[0];

var lastName = fullName[ fullName.length-1 ] ;

gs.log("firstName: "+firstName);

gs.log("lastName "+lastName );

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

3 REPLIES 3

AbhishekGardade
Giga Sage

Can you please elaborate more?

What is the email format you are receiving?

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

 

Thank you,
Abhishek Gardade

Sample script:

var empMail = 'abhishek.gardade@company.co.in';

var fullName = empMail.split('@')[0].split('.');

var firstName = fullName[0];

var lastName = fullName[ fullName.length-1 ] ;

gs.log("firstName: "+firstName);

gs.log("lastName "+lastName );

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

The email format is: firstname.lastname@xxxx.com