- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 12:34 AM
Hi All,
In inbound email integration user email id stored in user field in sys_email table that is the one from where we received mail but I am looking the way to get user name also. Is it possible to do that?
Thanks and regards,
Brijmohan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:40 AM
@Brijmohan
How about extracting name from email id that you are storing in user field:
var email = "test.bcdsn13243@example.com";
var pattern = /^(.*?)@/;
var match = pattern.exec(email);
var name = match[1];
var user_nameis = name.replace(/[\.\d]+/g, ' ');
gs.info("User's name: " + user_nameis); // Output - User's name: test bcdsn

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:42 AM
Hi @Brijmohan ,
you will not be able to get the name if user is not in the system.
How it really works: refer :https://developer.servicenow.com/dev.do#!/learn/courses/tokyo/app_store_learnv2_flowdesigner_tokyo_f...
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:47 AM
Hi @Brijmohan ,
You can try with this script to get the name from email id.
var email_text = email.body_text;
var email_html = email.body_html;
var User = email_text.split("<field_name>");
var storeNumber1 = User[1];
storeNumber1 = storeNumber1.split("<field_name>");
storeNumber1 = storeNumber1[0];
storeNumber1 = storeNumber1.trim();
storeNumber1 = storeNumber1.replace(/<[^>]*>/g, '');