- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 08:16 AM - edited 02-23-2024 08:19 AM
Hi All,
SNOW receives a mail as below:
I have 4 fields created on RITM table u_name, u_mailID, u_location and u_area. I want to create a RITM once the above mail is received and push the value from mail to the above fields mentioned on RITM. I have created an inbound action, need help on how to put the values from body to fields.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 01:08 AM
Hi @swapnil15 ,
Try with this updated code:
var text = email.body_text;
var adLoginPattern = /AD Login - (.+)/;
var emailPattern = /Email Address - (.+)/;
var locationPattern = /Location - (.+)/;
var areaPattern = /Area - (.+)/;
function extractValue(text, pattern) {
var match = text.match(pattern);
return match ? match[1].trim() : null; // Return the captured group (value) or null if not found
}
var adLogin = extractValue(text, adLoginPattern);
var email = extractValue(text, emailPattern);
var location = extractValue(text, locationPattern);
var area = extractValue(text, areaPattern);
current.u_name = adLogin;
current.u_mailID = email;
current.u_location = location;
current.u_area = area;
current.insert();
Request you to mark as Accepted Solution & Hit helpful button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 08:42 AM
Hi @swapnil15 ,
Please refer to below thread:
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 09:04 AM
I am sorry, how will that help with the requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 08:47 AM
Hello @swapnil15 ,
You can use the CartJS API ServiceNow Developers to create it.
In the inbound action you can check the string value of the email body, then get the necessary value and use the CartJS API.
Regards,
Huy Lam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 09:05 AM
Hi Minh,
Isnt that cartjs api is used to push the data to variables directly? Can you elaborate on how I can use this?