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 label as Library in user interface with key prefix 058, it represent 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 record in this object.

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


This object known File in 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 versions 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 document 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  

Few field need to note from this object:

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

FirstPublishLocationId, this field refer to where the first time document publish to, 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 document, new record for ContentVersion will be create, 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 also label as File in 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 record for this object, it is control 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 open 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 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