I am working on a solution where we have an 'Email to Case Premium' or E2CP app added to our Case object in Salesforce. I would like to programmatically create a record in E2CP with Salesforce API call. Is that possible?

I can create a 'Case Comment' record with the Salesforce API, just trying to create a record in the E2CP. Would I need a different API altogether to create a record in E2CP?


  • Which record are you trying to create? of which object? – Json Oct 25 '18 at 8:38
  • The 'Email to Case Premium' or E2CP is an app (appexchange.salesforce.com/…) which is added our the Case object in Salesforce. Just trying to find ways to create a record in E2CP via backend code. – theITvideos Oct 25 '18 at 22:11
  • what i'm really trying to achieve is adding/linking an attachment to the Case Comment in Salesforce. I can create a Case Comment and I can create an Attachment. I am trying to establish a link the two so that when looking at the Case Comment, we could tell, here is the associated attachment for the Case comment. – theITvideos Oct 25 '18 at 22:14
  • I am very familiar with E2CP, please see my answer. – Json Oct 27 '18 at 15:50

Welcome @theTvideos to Salesforce StackExchange,

Email to Case Premium uses the standard Case Comment object, it is not part of it.

E2CP is a managed packaged and not a Salesforce object, therefore you can't create records of it.

In regards to your question in the comments section, the Case Comment object is not configurable so you can't add the 'Notes & Attachments' section to it. You can't even add a custom field to it.

However, you can create a custom object which will have the same functionality. It should have a master-detail relationship with the Case object, and you will also need a Visualforce page to display the records on a case record. In general, you should write a trigger on the EmailMessage object that will create a record of the new custom object whenever an email is being sent/received. I almost forgot mentioning that you can of course add the 'Notes & Attachments' section to any custom object.

Good Luck!

| improve this answer | |
  • Now you mentioned that E2CP is a managed packaged and not a Salesforce object. I would just like to get all the E2CP comments for a specific Case by passing the Case ID in the WHERE clause. Is there a particular SOQL query I could use to just get the E2CP case comments and its attachment detail? – theITvideos Oct 28 '18 at 10:57
  • Attachments and Case Comments are different objects, hence you'll need two seperate queries. Example for Case Comment query: SELECT Id FROM CaseComment WHERE ParentId= '<Salesforce_Case_Id>' – Json Oct 28 '18 at 11:30
  • I recommending reading E2CP documentation to understand how the product works, if that does not help, they have an excellent support team. – Json Oct 28 '18 at 11:32
  • Yes, you are right. 'Attachments' and 'Case Comments' are two different Salesforce objects and I may have to use two separate SOQL queries. One to get the Case Comment by specifying the Case ID as the parent ID. I am able to do that. How can I get the attachment information pertaining to the relevant individual Case Comment? I looked into the attachment object. It only has the parent ID of the 'Case' and not of the 'Case Comment'. What SOQL query would we use to get the Case Comment attachment information? – theITvideos Oct 28 '18 at 22:41
  • The query is similar - SELECT id FROM Attachment WHERE ParentId='<Salesforce_Case_Id>' So if you have a case with an attachment and a case comment, you can use the same ParentId (which is the case Id) – Json Oct 31 '18 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.