In this post, we will see how we can insert the Content Document or Content Version in Apex Test class.
Content Document: – Represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files.
Content Version: – Represents a specific version of a document in Salesforce CRM Content or Salesforce Files. One Content Document can have multiple content versions.
Content Document Link:- Represents the link between a Salesforce CRM Content document or Salesforce file and where it’s shared. A file can be shared with other users, groups, records, and Salesforce CRM Content libraries.
Here is the code for the test class.
ContentVersion – Contains the complete information about the Content Document. Which have the following field.
- Title – The title of a document.
- PathOnClient – The complete path of the document. One of the fields that determine the FileType.
- VersionData – The content of the file/document.
- Origin – The source of the content version. Valid values are:
- C—A content document from the user’s personal library. The label is Content. The FirstPublishLocationId must be the user’s ID. If FirstPublishLocationId is left blank, it defaults to the user’s ID.
- H—Salesforce files from the user’s My Files. The label is Chatter.
Thanks for reading 🙂
#HappyReading #DeveloperGeeks #AskPanther #SFDCPanther