Need help with this.


We have several support email addresses. A case is created when a customer sends us an email to one of those email addresses. We are using only one case record type. When a case is created from Email-to-Case, we want to set a product family value based on what email address it is.

If the email address is [email protected], set the product family value to "Apple."

If the email address is [email protected], set theproduct family value to "Orange."

How do I do this with a Case Trigger or Apex?

Thank you!!


2 Answers 2


You can do this with clicks instead of code. You can do a workflow eule based on the email message object on create where the "To Address" = your email2case address. enter image description here

Then have your action be a field update for the product family field.

You can also do a process, again based on the Email Messaged object on create to fire when the created date for the case = NOW() enter image description here

enter image description here


I understand you have multiple Email-to-case set ups for each of these email addresses. If so , can you not reuse the Case Origin field and tag one Email-to-case with one Case Origin(Product Family).

If you can't use the Case Origin field, you can create a Formula Field also which will set the value of the Product Family field based on the Support Email address. But this is applicable only when you have limited email addresses.

if you have more than 10 also the formula will be really complex and difficult to maintain. I would suggest create Contact records for each of these email addresses and capture the Product family in one field. Create a separate record type also as these are not real contacts. And then write a trigger to read the Product Family field from the corresponding contact when a Case is created.

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .