You need to sign in to do that
Don't have an account?

Help needed in parsing email with whitespaces to create cases through Email services
I'm having trouble processing incoming email to create cases. We have a same template format of incoming emails. I'm using substring to parse the data and create a case record. However, I'm unable to parse the data. I had no trouble creating cases for other template (other vendor) by using substrings. But for that, incoming email template looks like this (this is only certain section of the email):
Location: TEST #23880 @ SAMPLE#990
Street Address: 1111 Street, Test city, MI 48211
Point of Contact: Manager
For ex: To grab location from the email, I use:
Location: TEST #23880 @ SAMPLE#990
Street Address: 1111 Street, Test city, MI 48211
Point of Contact: Manager
For ex: To grab location from the email, I use:
String locationFinal = email.plainTextBody.substringBetween('Location: ', 'Street Address: '); // working fineFor the above template email, I can easily parse using the substrings. How do I parse for the below email template. I think the reason is because of the white space between the location and it's value 'TEST #23880 @ SAMPLE#990'. When I test it by getting rid of the white space it's creating cases. I tried using trim() and deletewhitespace() but nothing works. I'm getting null in the debug log. How do I make it work out with the presence of whitespaces?
Service Call Notification Test Facility Services Assignment Information: Call/Action #10935174 / 1 (Include this # on Invoice) Call/Action Type/Status Repair Service/SITE VISIT FIELD REPAIR/Received Service Center 021 - Central 1 Attention TEST SAMPLE Location TEST#23880 @ SAMPLE#990 Street Address 1111 Test Lane; Ft. Wayne, IN 46110 Point of Contact Manager Billing Address Test Street, Test city, IN 46500 Billing Phone 317-222-1111 Service Call Details: Severity HIGH Service Product Repair Product PREP EQUIPMENT Symptom Some problem Notes Test machine is not working, requires attention.

Any help guys?