function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jason KelleyJason Kelley 

Is it possible to insert list of ContentDistribution records?

I'm trying to create groups of ContentDistribution records via Apex.  Unfortunately, when inserting them, I'm getting the following error:
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>:
Here are the two records trying to insert:
ContentDistribution:{Name=test0, ContentVersionId=068m00000009X4zAAE, PreferencesAllowOriginalDownload=true, PreferencesAllowPDFDownload=true, PreferencesAllowViewInBrowser=true, ExpiryDate=2015-07-31 00:00:00, PreferencesExpires=true, RelatedRecordId=a4S60000000L1cgEAC}
ContentDistribution:{Name=test1, ContentVersionId=068m00000009X4zAAE, PreferencesAllowOriginalDownload=true, PreferencesAllowPDFDownload=true, PreferencesAllowViewInBrowser=true, ExpiryDate=2015-07-26 00:00:00, PreferencesExpires=true, RelatedRecordId=a4S60000000KztXEAS}
The only duplicate value between the two is the ContentVersionID, which I assume should be fine. 



 
Jason KelleyJason Kelley
Apparently the ContentVersionId cannot be the same.  Through the UI, you can create as many Content Deliveries for a single Content Version as you like.