Pull phone numbers from Email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
I turned on 'automatically create users for incoming emails from trusted domain'. Is it possible to pull phone numbers, if phone numbers are associated with the email information?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @athavichith ,
In your inbound email action, use a script in the Script field That reads email.body_text (or email.body) and uses a regular expression to find the phone number. Example:
var phoneMatch = email.body_text.match(/Phone:\s*([\d\-\(\)\s]+)/i);
if (phoneMatch && phoneMatch[1]) {
var phone = phoneMatch[1].trim();
current.phone_number = phone; // phone_number is a field created
}
After extracting the phone number, link it to the user record (if the user is created or exists). You might query sys_user by email (using email.from) to get the user’s record and set their phone field, or set a custom field on the incident/request/etc....
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/