Inbound Actions- parse first name and last name from email body to populate Opened by field.

Ritu2
Tera Contributor

Hi all, 

 

I have a simple requirement in Inbound action where I need to pick up the email address from email body and populate the Opened by field of the Request record.

The email address in the body is a service now user and will have a record in sys_user table.

the email address in the email body will always have case owner as prefix. 

 

Case owner: Ritu.sharma@xyz.com.au  (from email) to Ritu Sharma in Opened by field

 

Case owner: Chris.martin@xyz.com.au = Chris martin in opened by field

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, if your email body matches your example then the Case owner may be available as a name:value pair

Setting field values from the email body (servicenow.com)

If not, you would normally use javascript substring() to parse out the email address from the email.body_text.

Accessing email object variables (servicenow.com)

JavaScript String Methods (w3schools.com)
Once you have an email address you can use GlideRecord to lookup your sys_user (or contact) table and match the email to a user record, then map this to your 'Opened by' user.

GlideRecord | ServiceNow Developers

 

 

Tony Chatfield1
Kilo Patron

It is also best practice NOT to use 2 forum accounts when asking questions\seeking support and doing so is less likely to result in a clear outcome to your question\issues.

 

Parsing email address from email body to populate ... - ServiceNow Community

Hi Tony,

Thanks for replying,
I will check your suggested solutions now.
I agree I thought I posted it the wrong forum and that's why I posted it twice.
I