This was annoying and worth documenting
Starting conditions
- Record types defined on Case.
- Email2Case configured with email address
support@foo.com
using RecordType A and email addressorders@foo.com
using RecordType B. - RecordType A is the default record type for the automated case user (as configured in Case Settings).
- Automated Case User’s profile has access to both RecordType A and RecordType B.
You start testing
Since it typically requires liaison with your mail server team to establish the email addresses, verify-to-Salesforce their validity, and then auto-forward the email to the Salesforce email services address (e.g. verylongname@salesforce.com
), you will be tempted during testing to try sending emails to verylongname@salesforce.com
as this is what Salesforce actually would receive.
You will be surprised.
If the email you send to is for the Automated Case User’s profile’s non-default recordtype, then the recordType assigned to the Case will be the default record type (!?!). This happens in either of the following circumstances:
- Email-to-case address is not verified, or ..
- Email-to-case address is verified
That is, in order to get the correct recordType assigned, you have to send the email to your company’s email domain and have that email forwarded to Salesforce.
Example:
- RecordType A is default recordType for Automated Case User
- Email-to-Case address
orders@foo.com
is configured to use RecordType B - Email-to-Case address
orders@foo.com
is associated toorders-verylongname@salesforce.com
Results:
- Send email to
orders-verylongname@salesforce.com
. Result: Case created with recordType A ?!? - Verify
orders@foo.com
and send email toorders-verylongname@salesforce.com
. Result: Case created with recordType A ?!? - Establish forwarding rules in your mail server that forward
orders@foo.com
toorders-verylongname@salesforce.com
. Send email toorders@foo.com
. Result: Case created with recordType B Hooray!