- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 12:46 PM
I am using an inbound action to parse the body of the email. I have done this fine for strings and where the name of the name/value pair is one word. However, I am unable to figure out how to parse it when the name is separated by a space.
Two questions:
1) How to parse where name has spaces?
2) How to insert into a Date type field?
Email Example
<Body>
Pricing Effective: 04/11/2017
</Body>
Inbound Action Script
current.u_my_custom_date_field = email.body."Pricing Effective";
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 01:08 PM
Ignore the previous one.
The Date format should be same as system date format
var mydate = email.body_text.indexOf('Pricing Effective: ');
var gDate = new GlideDate();
gDate.setValue(mydate);
gs.info(gDate);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2017 12:10 PM
Now that I tried it, I'm marking yours as correct. Setting the field as a Date works perfect, however, pulling the result for a 2 worded label is close but not correct. If I use the index of, it was displaying a numeric value. In my case it was showing 197. So this must be literally showing the index of the string. I finally found on another post that the correct way to pull a 2 worded label is just doing email.body.<name> but if the label is two worded, replace the space with the underscore. That did the trick
Below is what works:
<Email Body>
Pricing Effective: 06/11/2017
<Inbound email action>
var gDate = new GlideDate();
gDate.setValue(email.body.pricing_effective);
current.u_pss_pricing_effective_date = gDate;
gs.info("Pricing Date from email: " + gDate);
Other post:
Finding text in emails - inbound email actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 08:06 AM
I am trying to accomplish something similar... The email coming into the system will contain the following line and I need to input the value into a field on the item being created.
Application Name : ServiceNow
I used email.body_text.indexOf('Application Name : '); but the system is giving the character position instead of the value.
Any ideas??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 08:14 AM
You need to use email.body.application_name
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 08:19 AM
Ah ok! Thanks for the quick reply 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 06:37 AM
You just need to use email.body.pricing_effective, as per SN docs: