Sometime I get emails from a customers in reply to a resolved case. They actually report a new problem but since they use reply, the email is being associated to the old case. Is there a way to create a new case from an existing email or at least to re-parent the email to a new case I will manually create?
4 Answers
To allow this to happen, EmailMessage.ParentId would need to be modifiable.
Since the DML framework does not allow this, you will not be able to write Apex code to make this happen.
-
note this answer addresses only one option - reparenting an email - to solve OP question; my answer suggested another solution– cropredyCommented Mar 27, 2015 at 18:29
As part of the Winter '25 release, Salesforce is deploying a new feature: Move Emails Easily to the Relevant Case.
You can enable this feature by selecting the Let agents move emails
setting in Email-to-Case settings in Setup.
-
For those who want to move an email from one case to another via Flow or Apex: this setting does not make ParentId modifiable. Commented Nov 19 at 12:16
-
I have found that it is possible to update the ParentId on an incoming EmailMessage before insert in a Trigger. I have not tested this with Flow. Every business process may be different, but our process is that an incoming Email on a closed case should be assigned to a new case if the original case has been closed for longer than 30 days.– RoosterCommented Nov 26 at 18:44
Assuming that the email was added to the closed case because it came in on Email-to-Case with a thread ID somewhere in the subject or body resembling: ref:_ ... :ref
, then you could do the following:
- Open the email and copy the contents into a text editor
- Change all
ref:_
tofoo:_
(or remove all the threadids entirely) - Create a new email using the edited text and send to your Email-To-Case email address (the one used by your customers) - e.g. [email protected]
SFDC will create a new Case; you can then go to that Case and change the Contact ID and Account reference to the true customer (not the sender at step 3)
Dedo, maybe I'm misunderstanding something, but if you want to manually reparent the email (i.e., Task record), would that be to...
- Open the task in Salesforce
- Click Edit
- Change the Related To field?
-
I'm talking about incoming email to case emails. They don't have these fields– DedoCommented May 9, 2014 at 7:16
-
Dedo, you said "to re-parent the email to a new case I will manually create", which implies that you are going into Salesforce after the email is automatically processed and fixing the association. If you're trying to handle the incorrect association in code when the incoming email is processed, the first question is: How are you determining that the email is actually reporting a new problem (i.e., case), instead of following up on the existing case? Are you doing that simply based on the fact that the case was already closed?– Marty C.Commented May 9, 2014 at 10:55