Salesforce has a Email to Case functionality which allows customers internal or external to send a request to an email address and have a transaction created for e.g. a Case created and have support teams service the Case.
In such cases you will see Incoming emails logged against the Case in the Emails related list.
Similarly if an email is initiated from a Case thru the Emails related list and sent, then the Email is associated to the Case.
Now, what if you want to send email thru Code and have it logged against your Transaction.
Solution
Enter the Case Thread ID.
This is something that Salesforce uses to associate emails to a Case if an email is sent to a Email to Case address. In the absence of Case Thread ID in the Body or in the Subject line a New Case is created else the email is associated to the existing Transaction.
This internally used field can be leveraged to do associations of our own.
Create a Formula field as follows in your entity:
In such cases you will see Incoming emails logged against the Case in the Emails related list.
Similarly if an email is initiated from a Case thru the Emails related list and sent, then the Email is associated to the Case.
Now, what if you want to send email thru Code and have it logged against your Transaction.
Solution
Enter the Case Thread ID.
This is something that Salesforce uses to associate emails to a Case if an email is sent to a Email to Case address. In the absence of Case Thread ID in the Body or in the Subject line a New Case is created else the email is associated to the existing Transaction.
This internally used field can be leveraged to do associations of our own.
Create a Formula field as follows in your entity:
"ref:_" & LEFT($Organization.Id,5) &
SUBSTITUTE(RIGHT($Organization.Id,11),"0","") &
"._" & LEFT(Id,5) & SUBSTITUTE(Left(RIGHT(Id,10),5),"0","")
& RIGHT(Id,5) & ":ref"
Now, when sending
emails thru Code, you need to append the formula field to either the Subject
line or to the body of the email and also CC to the Email to Case email
address.
This creates a closed loop so that you are aware of the Emails being sent out what was sent out and can always be visited any time by users for reference.
No comments:
Post a Comment