Sample Code for a Professional Looking Web-to-Case Form
Jul 29, 2005A web-to-case form can be used to capture cases from your website and route them as fielded information into salesforce.com.
While it’s easy to generate the HTML for a web-case-form from inside salesforce.com, Chris Bonacore a salesforce.com Sales Engineer, has modified the html to pretty it up a bit. It utilizes the salesforce stylesheet for buttons, field labels, etc. It also takes advantage of JavaScript for formatting a phone number field.
To see what it looks like and to demo the
functionality, you can Download his Web-to-Case.htm
to your desktop. Clicking on that hyperlink will open the file. To download, simply right click on the link and save target as.
To make it work for your org specifically, here’s what you’d need to setup.
First change
the sample org id to your org id
To find out your Org ID, go to Setup,
Administration Setup, Company Profile, Company
Information. On the right side you’ll see a field called Salesforce.com Organization
ID.
<input
type=hidden name="orgid" value="00X300000000ASD">
If you
want a confirmation email, please change debug to 1 and your email
address.
<input
type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="youremail@acme.com">
If you
want to go to another website other than salesforce.com, probably the
customer's home page, then set debug to 0 and specify the URL
<input
type="hidden" name="debug" value=0>
<input
type=hidden name="retURL" value="http://www.acme.com">
When it’s set up, Web-to-Case will try to match the Case to Contact via the Email address on the form. Give it a try and see if Web-to-Case can help streamline your workflow.


Dorothy Mantooth is a saint!
Posted by: Jason | August 23, 2005 at 12:28 PM
Can I add a field for file attachments in the form, so that the attachments can be added for the new case?
Posted by: Thomas | March 27, 2006 at 02:05 PM
Thomas, not as far I know. If you have server side programming skills, you could upload the file to your server and reference the URL as a field in the case.
Posted by: Kingsley | March 27, 2006 at 06:49 PM