Inbound email integration

Brijmohan
Tera Contributor

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

1 ACCEPTED SOLUTION

@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 

View solution in original post

6 REPLIES 6

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... 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Renu10
Tera Contributor

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'');