How to parse a line from email xml and assign to a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 07:14 AM
Hi team,
I've created an Inbound action that creates a task whenever an email is received with certain words are in the body text and got it working. But unable to determine how to parse a particular line that can then be assigned to a variable
For example if I receive the email below and have a task created with this info
Hello,
<IP_Address> 127.0.0.1 </IP_Address>
<Name> Joe Smith </Name>
<Title> Employee </Title>
Is there a way I can grab, say the IP Address as well as Title and assign them each to their own task variable, say u_ip_address and u_user_title? Trying to make it when a task is created I can have these fields auto-filled
Everything I've seen shows how to match but not anything past.
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 07:22 AM
Hey,
You will need XML parser to achieve this, found one article that does the same:
https://community.servicenow.com/community?id=community_question&sys_id=99428a72dbd3009023f4a345ca9619db
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 12:54 PM
Unless I'm reading that page incorrectly it looks like the XML parser sorts out the xml file into a more readable format. While it's impressive I don't think it's doing what I'm looking for, which is to copy the line and make it the value of a variable.
For example, when an email is received my Inbound rule creates a task, in addition I'd also like for two fields to be filled out based upon what's in the email, in this case IP Address and Title. If it's in your link would you mind pointing it out?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 07:27 AM
https://docs.servicenow.com/en-US/bundle/sandiego-application-development/page/script/server-scripting/concept/c_XMLDocumentScriptObject.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 07:28 AM
if you are using flow designer, the xml parser will make your job so much easier.
https://docs.servicenow.com/bundle/paris-servicenow-platform/page/administer/flow-designer/reference/xml-parser-step-action-designer.html