function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sharidansharidan 

Need formatting information for Email To Case On Demand

Hello, I currently have an application that uses web2case and I'd want to move away from that to using email2case.  New in Spring 09 is using email to case on demand.  Can anyone give me advice on how to format the email?
Best Answer chosen by Admin (Salesforce Developers) 
MarkSilberMarkSilber
The only reference I could quickly find about handling web2case during system downtimes is from the online help:

How can I be sure that cases will not be lost?

If your organization exceeds its daily Web-to-Case limit, the Default Case Owner (specified in the Support Settings) will receive an email containing the additional case information. Also, if a new case cannot be generated due to errors in your Web-to-Case setup, Customer Support is notified of the problem so that we can assist you in correcting it.

Salesforce also utilizes technology to ensure that your cases will not be lost if users submit them during a scheduled Salesforce downtime.

All Answers

MarkSilberMarkSilber
Not sure what you mean by "formatting"? Do you mean how would you format an email to parse information from it? That functionality is not native Email2Case behavior. Email-to-Case simply takes the email subject and puts it in the Case Subject field and the email body and puts it in the Case Description field. Any additional emails (inbound or outbound) are added to the Email Message related list and Activity History related list.

If you want to parse an email and have a lot of fields to pull specific information from, you may need to explore using a trigger. If you only have a few fields to pull out of an email, you could use some workflow rules to look for information in the subject or body of the email and place those in real fields using normal text functions.
sharidansharidan

Currently, we use a submission process of web2case in which we format an html post which builds new cases that have specific bits of information in it.  See below to see the formatting I'm talking about.

 

<input id = orgid name='orgid' value='00D400000006p8b'>
<input type='hidden' name='retURL' value='https://site.com/MyForm.aspx?Result=1'>
<input id='name' maxlength='80' name = 'name' value='John Doe' size='20' type='text' />
<input id='email' maxlength='80' name = 'email' value="jdoe@mysite.com" size='20' type='text' />
<input id='phone' maxlength='40' name = 'phone' value='' size='20' type='text' />
<input id='00D40000001YlDm' maxlength='100' name = '00N60000001YlDm' value='Client Business' size='20' type='text' />
<input id='00D40000001VRje' maxlength='150' name = '00N60000001VRje' value='Contact Name' size='20' type='text' />
<input id='00D40000001YqqK' maxlength='25' name = '00N60000001YqqK' value='Contact ID' size='20' type='text' />
<input id='00D40000001VRmN' maxlength='150' name = '00N60000001VRmN' value='Referral Name' size='20' type='text' />
<input id='00D40000001VRjP' name = '00N60000001VRjP' maxlength='12' value='03/31/2009' size='20' type='text' class='dateInput' />
<input id='00D40000001VRmS' name = '00N60000001VRmS' maxlength='12' value='03/17/2009' size='20' type='text' class='dateInput' />
<input id='00D40000001Valx' name = '00N60000001Valx' maxlength='100' value='Contact Name' size='20' type='text' />
<input id='00D40000001YlAW' name = '00N60000001YlAW' maxlength='100' value='\\server\localfile\Contact Name.pdf' size='20' type='text' />
<input type='hidden' id='external' name='external' value='1' />

Message Edited by sharidan on 03-18-2009 06:55 AM
MarkSilberMarkSilber
It looks like you are capturing quite a bit of information from the users posting via web2case. I would recommend you stay with that approach versus switching to email2case. Email2case is really designed for more unstructured interactions and can't provide a consistent way for your users to send additional information besides the subject and body. Why are you trying to move from web2case to email2case?
sharidansharidan
I need this for better reliability.  What I find happening is at random a case will not post.  I had to build in functionality to grab these html posts and send them to myself in an email as a backup in the event a case gets lost. 
MarkSilberMarkSilber
Web2case should be just as reliable as email2case. Even during Salesforce scheduled maintenance, the cases submitted via web2case are queued (like they are with email2caes). Do you have any validation rules on cases that might cause a case to be rejected?

Are you planning to have a web form that takes the input and then produces a formatted email versus having users actually compose the email? That's a bit different and you would be able to pull some of the data from the email body and put it into specific fields on the case. I just wouldn't recommend replacing a web form that forces users to provide some additional case information with a free-form email that doesn't require it.
sharidansharidan

"Are you planning to have a web form that takes the input and then produces a formatted email versus having users actually compose the email? That's a bit different and you would be able to pull some of the data from the email body and put it into specific fields on the case. I just wouldn't recommend replacing a web form that forces users to provide some additional case information with a free-form email that doesn't require it."

 

That is exactly what I'm trying to do.  So what would I need to change to make this possible?

MarkSilberMarkSilber
Using email2case will set some of the fields by default, including the Contact and Account fields if you are "spoofing" the sender and they exist as a Contact already in Salesforce, the Case Origin and Priority (based on the routing rules). If you can determine the default values based on where the email was sent to -- that is, you have specific email2case email addresses and routing rules, you can use basic workflow to default some of the additional fields.

For the remaining fields, you have 2 options. One is a trigger that just reads the body and parses out the information using normal TEXT functions, such as " MID(fieldname,5,10) ". You can do the same using Field Updates in workflow and formulas, but it will be difficult for picklist values since you can't use a formula field to set a picklist field.

You would build your workflow on the Email Message object, but set the fields on the Case object. You have to have a Field Update workflow action for each field you intent to parse from the email message and then use the same TEXT functions to grab the actual data and stuff it in a field.


sharidansharidan
Can you offer me a sample of what the email message should look like?  I'm still kind of new with the force development platform.
MarkSilberMarkSilber
It really depends on what you are parsing, but here's a simple example of an email we use from ClearQuest to Salesforce. Not all these fields are parsed from the original message, only some of them are. In your workflow, you will need to locate the field using formulas and the MID and FIND functions then pull the data out. It's not a trival task, but can be done. In the example below, the entire email body is captured in the Case description and a few of the fields are parsed using workflow to update actual Case fields.

id: abc00002865
State: Assigned
submitter:bsmith
submit_date: 2009-03-10 13:58:12
submitter_team:
priority: 4-Low
severity: 4-Low
defect_type: Request
reproducible: Always
equipment_device_affected:
oem_issue:
project: My Project Name
product: My Product
product_version: N/A
component:
sw_version:
hw_version:
headline: TEST by ClearQuest Admin
description: TEST by ClearQuest Admin
Notes_Log:
Attachments:

sharidansharidan
So the information in the body of the email would be placed into description?  Hmmm...that could be trouble.  I can't manipulate what SF does with email2case?  I guess I was under the impression that I could let my form submittal push the fields via email.
MarkSilberMarkSilber
Email is unstructured - there is only address, subject and body information. In order to grab data from an email, you have to have it in a specific format and then use functions to actually pull the data. If you are trying to pass more than a few fields, I would recommend you continue to use Web2Case and work on figuring out why you may have some cases that don't come through.

Joe_IpsenJoe_Ipsen

Mark Silber wrote:
Web2case should be just as reliable as email2case. Even during Salesforce scheduled maintenance, the cases submitted via web2case are queued (like they are with email2caes). Do you have any validation rules on cases that might cause a case to be rejected?

Are you planning to have a web form that takes the input and then produces a formatted email versus having users actually compose the email? That's a bit different and you would be able to pull some of the data from the email body and put it into specific fields on the case. I just wouldn't recommend replacing a web form that forces users to provide some additional case information with a free-form email that doesn't require it.

 

 I did not know that.  Can you direct me to a resource that provides more information on how the Web2Case posts are queued? 

Message Edited by Joe_Ipsen on 06-18-2009 02:07 PM
Joe_IpsenJoe_Ipsen

I have a particular set of emails coming into SFDC that are being converted into cases, but the system that generates these is using noreply@domain.com as the From: address and the actual customer's email is included in the Reply-to:.  Because of this, all of the cases have a Web Email address of noreply@domain.com and the actual email address is only accessible by viewing the headers of the Message object.

 

From a support perspective, this is very labor intensive as they have to extract the address from the Message object and update the field in the case.  How can we automate this?

 

After looking at the fields available to Workflow and Field Updates on the Message Object, I did not find a way to pull this information out and insert it onto the case in the Web Email address.  

 

If this is possible using workflow or even a simple trigger I would like to hear your suggestions as this seems much more attainable than the option I have considered:

 

- rebuilding On-demand Email-to-Case using an Apex Email service.

- writing an Apex Email Service to accept these messages and swap the two addresses with the hope that it could then hand the message off to On-demand Email-to-Case.

MarkSilberMarkSilber
The only reference I could quickly find about handling web2case during system downtimes is from the online help:

How can I be sure that cases will not be lost?

If your organization exceeds its daily Web-to-Case limit, the Default Case Owner (specified in the Support Settings) will receive an email containing the additional case information. Also, if a new case cannot be generated due to errors in your Web-to-Case setup, Customer Support is notified of the problem so that we can assist you in correcting it.

Salesforce also utilizes technology to ensure that your cases will not be lost if users submit them during a scheduled Salesforce downtime.

This was selected as the best answer
MarkSilberMarkSilber

I'm not sure which method would be easier, creating a brand-new email Service or a trigger that modifies the case before insert. If you go the email services route, you can't use email2case since the email address is automatically generated and specific to the apex email service.

 

If you put a trigger directly on the Case, you will have to a little more work to get the details from the email message. One possible solution would be a email message workflow to copy the header from the original email to the case only when it's first created, and they use your trigger to query the Contact email address for a match based on the header reply-to field and set it.