June 11, 2021

Files attached to Messages in Salesforce Messaging

Files are stored in ContentDocument entity. 
 
Use this soql to find the ContentDocumentId. 
SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '<MessagingSessionId>'
 
Example:
1. Run the below SOQL.
SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '0Mw3h00000146TkCAI'
 
 0Mw3h00000146TkCAI is the Messaging Session Id.

2. Use the ContentDocumentId and open the file.


No comments:

Post a Comment