+ Start a Discussion
NAGAM VENKATA KRISHNA 8NAGAM VENKATA KRISHNA 8 

I have to insert the record to objects from salesforce emailServices.After insertion of record I have to generate the unique String called RefID and then respond back to same email saying that a new case is created

OFröhlichOFröhlich
Hi,
I would not spend to much time in the RefId. It will be replaced with summer release '22. Enclosed two links:
https://help.salesforce.com/articleView?id=000356212&language=en_US&mode=1&type=1 (https://help.salesforce.com/articleView?id=000356212&language=en_US&mode=1&type=1" style="color:#0563c1; text-decoration:underline)
https://help.salesforce.com/articleView?id=sf.support_email_to_case_threading.htm&type=5 (https://help.salesforce.com/articleView?id=sf.support_email_to_case_threading.htm&type=5" style="color:#0563c1; text-decoration:underline)
Use Cases.getCaseIdFromEmailHeaders instead of Cases.getCaseIdFromEmailThreadId


If this helps, please mark as Best Answer to help others too.
Suraj Tripathi 47Suraj Tripathi 47
Hi NAGAM,

You can easily insert the record to objects from salesforce email services follow below steps to do this -

1. Create an apex class where you process your email.
2. Create a record in Email Services from Setup and assign this apex class name into the email service record.
3. From where you get an email address which you have to use while email sending

For more details follow the below link:
https://www.mstsolutions.com/technical/email-services-in-salesforce-email-to-object/   (https://www.mstsolutions.com/technical/email-services-in-salesforce-email-to-object/  )


If you find your Solution then mark this as the best answer. 

Thank you!

Regards 
Suraj Tripathi