Sub topic 3
Where cases come from: Email-to-Case, Web-to-Case, and manual entry
This chapter assumes you know the Case object's main fields from earlier chapters, can move around Setup, and understand that a queue is a shared owner for cases. It covers the three standard ways a case is created, what each one populates, and what to check when a case lands in the wrong place or doesn't appear at all.
Why the channel matters
Every case enters Salesforce through some channel. The channel determines three things you will rely on later:
- Which fields are filled in at creation (Origin, the "Web" or "Supplied" fields, Contact).
- Whether an assignment rule runs automatically or has to be requested.
- Whether replies from the customer attach to the same case or open a new one.
Routing and escalation rules act on whatever the channel produced. If the Origin or Priority values are wrong at creation, the rules downstream will misfire.
The Origin field
Origin is a picklist on Case that records where the case came from. Standard values include Phone, Email, and Web, and administrators can add more, such as Chat or Social. Two points to remember:
- Email-to-Case and Web-to-Case set Origin for you (Email and Web by default). You can change the default in the channel's settings.
- Manual and API-created cases only have an Origin if a person or program sets it.
Because assignment rule criteria and reports often filter on Origin, keep the picklist small and consistent. A report grouped by Origin shows the channel mix at a glance:
SELECT Origin, COUNT(Id) total
FROM Case
WHERE CreatedDate = LAST_N_DAYS:30
GROUP BY Origin
ORDER BY COUNT(Id) DESCManual entry
Agents create cases by hand from the Cases tab, from a Contact or Account related list, or from a console. This is the right channel for phone calls and walk-ins.
Manual entry behaves differently from the automated channels in one important way. When an agent saves a new case in the UI, the case page can show an "Assign using active assignment rules" checkbox, but only if it is on the page layout. If it is not checked or not on the layout, the case is owned by the person who created it, and no rule runs.
- Put the checkbox on the layout for any profile that creates cases for others, and consider making it default to checked.
- Set Origin to Phone (or your equivalent) so reports can separate manual cases from automated ones.
- Link the Contact and Account yourself. Nothing matches them for you.
Web-to-Case
Web-to-Case turns an HTML form on your public website into cases. Salesforce generates the form, and you paste it into your site.
Setup
- In Setup, search for Web-to-Case and click Edit on the settings page.
- Select Enable Web-to-Case.
- Choose a Default Case Origin (such as Web) and an optional Default Response Template to send an automatic acknowledgement.
- Save, then use Generate the HTML to choose the fields to include.
The generated markup looks like this. Replace the orgid value with your own 15 or 18 character org ID, which the generator fills in for you.
<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="00DXXXXXXXXXXXX">
<input type="hidden" name="retURL" value="https://www.example.com/thank-you">
<label for="name">Contact Name</label>
<input id="name" name="name" maxlength="80" type="text"><br>
<label for="email">Email</label>
<input id="email" name="email" maxlength="80" type="text"><br>
<label for="subject">Subject</label>
<input id="subject" name="subject" maxlength="80" type="text"><br>
<label for="priority">Priority</label>
<select id="priority" name="priority">
<option value="High">High</option>
<option value="Medium" selected>Medium</option>
<option value="Low">Low</option>
</select><br>
<label for="description">Description</label>
<textarea id="description" name="description"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>What the form populates
Web-to-Case stores what the visitor typed in the "Web" fields on the case: Web Name, Web Email, Web Company, and Web Phone. The API names are SuppliedName, SuppliedEmail, SuppliedCompany, and SuppliedPhone. Salesforce then tries to match the email address to an existing contact:
- One match: the case is linked to that contact (and its account).
- No match, or several matches: the Contact stays blank, and the Supplied fields are your only record of who wrote in.
Cases created this way run the active assignment rule automatically, which is why a Web-to-Case form is the usual way to feed a queue.
Limits and gotchas
- Web-to-Case has a daily limit, 5,000 submissions per 24 hours by default. Submissions over the limit do not become cases, so a public form that gets spammed can lock out real customers.
- Anyone can post to the form, because it is public. Add reCAPTCHA or another spam control, and do not rely on hidden fields for anything sensitive.
- Field names in the form must match the case field names. A typo in a name attribute is silently ignored, and the data is lost.
- A picklist value that is not valid for the field can cause the whole value to be dropped. Keep the form's options in step with the picklist.
Email-to-Case
Email-to-Case turns incoming email into cases, so customers can write to [email protected] without using a form. The standard option is On-Demand Email-to-Case, which runs inside Salesforce and needs no software on your servers. An older option, the Email-to-Case Agent, runs behind your firewall and is only needed when mail cannot leave your network.
How it works
- You create a routing address in Setup under Email-to-Case. It defines the default Origin, Priority, owner, and whether to save email headers.
- Salesforce generates a long email address for that routing address and asks you to verify it by clicking a link in an email.
- You forward mail from your public address ([email protected]) to the generated address.
- Each incoming message creates a case, and the email is attached to it as an Email Message record.
Threading replies
If a customer replies to a message about an existing case, you want the reply to land on that case, not start a new one. Turn on the Email-to-Case setting that inserts a thread ID in the subject or body of outgoing messages. A thread ID is a token that starts with ref: and encodes your org and the case. When the reply comes back with the token intact, Salesforce attaches it to the original case.
Matching the contact
Email-to-Case looks up the sender's address among your contacts. As with Web-to-Case, a single match links the contact, and no match leaves Contact empty with the sender recorded in Web Email. Choose carefully whether you want to create contacts automatically, since a spam message can then become a contact.
Common errors
- Routing address not verified. The address stays inactive and nothing arrives. Resend the verification email.
- Forwarding loops. If the auto-response goes to an address that forwards back to the routing address, cases multiply. Use a no-reply sender for auto-responses.
- Wrong default owner. The owner on the routing address applies when no assignment rule gives a different result. A missing or inactive rule makes every email case go to that default owner.
Comparing the three channels
| Channel | Sets Origin | Runs assignment rule | Links Contact | Typical use |
|---|---|---|---|---|
| Manual entry | Only if the agent sets it | Only if the checkbox is selected | Agent chooses | Phone calls, walk-ins |
| Web-to-Case | Default Case Origin setting | Yes, automatically | By email match | Public support form |
| Email-to-Case | Email (default on the routing address) | Yes, automatically | By email match | Shared support mailbox |
Cases created from Apex or the API belong to a fourth group. They behave like manual entry in that no rule runs unless the code requests it, which a later chapter covers.
Designing for channels
- Use Origin in assignment rule criteria when channels need different handling, such as sending Email cases to a general queue and Phone cases to Tier 1.
- Test each channel separately. A rule that works for manual cases can fail for Web-to-Case if the form omits a field the rule examines.
- Decide what happens to a case that matches no rule entry. It goes to the default case owner configured for the rule, so that person or queue must exist and be monitored.
- Track daily volume per channel so you notice a spam spike before the Web-to-Case limit is reached.
Exercise
A customer replies to an Email-to-Case message, and the reply creates a brand new case instead of attaching to the original one. Name the likely cause and one fix.
Show answer
The thread ID was missing from the reply, probably because the customer's mail client stripped it or because the thread ID setting was off for outgoing messages. Turn on the setting that inserts the thread ID in the subject or body, and check that auto-replies and templates keep the token.
Exercise
Agents report that cases they create by hand always stay with them and never reach the Tier 1 queue, while Web-to-Case cases reach it correctly. What is the likely cause?
Show answer
Manual cases only run assignment rules when "Assign using active assignment rules" is selected on the save. That checkbox is probably missing from the page layout or left unchecked, so the cases keep the creator as owner. Add the checkbox to the layout, and consider defaulting it to checked.