Sunday, November 2, 2014

Salesforce: Content Architecture

Before discussing Content in Salesforce, it is good to have a look for a few objects related to Content:


This object is labeled as Library in the user interface with the key prefix 058, it represents a public library in Salesforce CRM Content. This object is available in versions 17.0 and later. This object does not apply to personal libraries.

You cannot use API to create records in this object.

SOQL sample: SELECT Id,Name,Description,TagModel FROM ContentWorkspace


This object known as File in the user interface with key prefix 068, it represents a specific version of a document in Salesforce Content or file in Chatter. The maximum number of versions that can be
published in a 24-hour period is 36,000. This object is available in version 17.0 and later for Salesforce CRM Content and versions 20.0 and later for Chatter files.

This is the object you need to point to if would like to mass load documents into Public Library. You can use API to mass load documents.

Sample of CSV file to mass load document:

 this is 301 file,"This is a test file, use for bulk upload",d:\temp\301.txt,d:\temp\301.txt,05850000000GwZBAA0,exam  

A few fields need to note from this object:

FileType, when you upload a document, Salesforce will determine the file type: CSV, EXCEL, LINK, PDF, PNG, TEXT, WORD, ZIP, UNKNOWN
If the filetype is Link, then the ContentUrl field will contain a URL, this is when you add a Website link to the Library.

FirstPublishLocationId, this field refers to where the first-time document publishes, it may be an object, user, or a Library (which is ContentWorkspace).

ContentDocumentId & VersionId, when you load a document to ContentVersion, Salesforce will automatically create a record in ContentDocument. But, when you upload a new version of the document, a new record for ContentVersion will be created, but not for ContentDocument

SOQL sample: SELECT Id,ContentDocumentId,VersionNumber,Title,ContentLocation,ContentSize,ContentUrl,Description,FeaturedContentBoost,FeaturedContentDate,FileExtension,FileType,FirstPublishLocationId,IsLatest,IsMajorVersion,Language,Origin,PathOnClient,PublishStatus,ReasonForChange,TagCsv FROM ContentVersion ORDER BY ContentDocumentId,VersionNumber


This object is also labeled as a File in the user interface with key prefix 069, it represents a document that has been uploaded to a library in Salesforce CRM Content or a file in Chatter. This object is available in API versions 17.0 or version 21.0 and later for Chatter files. The maximum number of documents that can be published is 2,000,000.

You cannot manually create records for this object, it is controlled by ContentVersion.

Field to note from this object:
ParentId, Id of the library that owns the document. This record will be created automatically when you load a document or via the API for the first time. This field is available in API version 24.0 and later when Salesforce CRM Content is enabled.

For Content Document / Files in a Library, you will notice the icon when opening the File

SOQL sample: SELECT Id,LatestPublishedVersionId,ParentId,Description,FileExtension,FileType,PublishStatus,Title FROM ContentDocument order by ParentId


This object is known as Content Delivery in the user interface with key prefix 05D, it represents information about sharing a document. This object is available in API version 32.0 and later.

You can mass create records using API to this object.

SQOL sample: SELECT ContentDocumentId,ContentVersionId,DistributionPublicUrl,ExpiryDate,FirstViewDate,Id,IsDeleted,LastViewDate,Name,Password,RelatedRecordId,ViewCount FROM ContentDistribution


No comments:

Post a Comment

Page-level ad