Skip to main content
Hi

I need to fetch content all the attached files and also email messages of a case object using apex classes.Below are my SOQL,I am new to apex so unable to write apex class to achieve this.Please help on how to write apex class for this.I need to send this to an external webservice to attach these attachments in 3rd party system called Oracle service cloud Incident objects.

SOQL:

Below will give the contentdocumentId's of email message of case object where parent id caseId.

SELECT ContentDocumentIds FROM EmailMessage where ParentId='CaseId'

With contentId's retrieved from above query,I can get the file content using below query.

SELECT VersionData,Title FROM ContentVersion WHERE ContentDocumentId='Pass ContentDocumentId's from above query'

Please help how to achieve this through a Apex class.

Thank you

1 个回答
0/9000