Newer Version Available
ContentDistribution
Represents information about sharing a document externally. This object
is available in API version 32.0 and later.
Supported Calls
create(), delete(), describeSObjects(), query(), retrieve(), undelete(), update(), upsert()
Special Access Rules
- Content deliveries must be enabled to query content deliveries.
- Users (including users with the “View All Data” permission) can query only the files that they have access to. If the file is managed by a Content Library, the user must have “Deliver Content” enabled in the library permission definition and be a member of the library. If the file isn’t managed by a Content Library, the user must have the “Enable Creation of Content Deliveries for Salesforce Files” permission.
- Users can query the DistributionPublicUrl and Password fields only if they are the file owner, if the file is shared with them, or if the RelatedRecordId specifies a record that the users can access.
- If the shared document is deleted, the delete cascades to any associated ContentDistribution. The ContentDistribution is still queryable by using the QueryAll verb.
- If the shared document is archived, the only fields that users can edit are ExpiryDate and PreferencesExpires.
- Customer Portal users can’t access this object.
- Chatter Free users can’t access this object.
Fields
Usage
Use this object to create, update, delete, or query information about a document shared externally via a link or via Salesforce CRM Content delivery.
The ContentDistribution object supports triggers before and after these operations: insert, update, delete. It supports triggers after undelete.
Example
The VP of Marketing wants file authors to specify whether their files can be shared with
external people using content delivery. He also wants some files to have a password. You
can add a custom field DeliveryPolicy on the ContentVersion object.
Make the custom field a picklist with the values, Allowed, Blocked, and Password required. Add the field to the ContentVersion
layout so that the user can set the delivery policy per file. Then, add an insert
trigger for the ContentDistribution object to enforce the rules based on the delivery
policy set in the file.
This trigger
for the ContentDistribution object enforces the delivery policy rules for each
file:
The trigger calls this helper
class: