2

Can someone help me understand why I would get this error? My understanding is that I should be able to insert a new ContentDelivery by using similar code:

ContentDistribution cd = new ContentDistribution();
cd.name = 'test';
cd.ContentVersionId = '1234567891011AA'; - using real Id
cd.PreferencesAllowOriginalDownload = false;
cd.PreferencesAllowPDFDownload = false;
cd.PreferencesAllowViewInBrowser = true;
insert cd;

Deliveries are enabled and I am a system admin attempting to run this code from an Anonymous block in a Sandbox.

1

Apparently I was using the Document Id and not the Version Id! Boy do I feel stupid!

0
0

It appears to me that you're trying to insert Content. If so, then you need to use the ContentVersion object. That would be the cross reference Id that the error is referring to.

From the documentation:

To update a Salesforce CRM Content document, the user must be a member of the library with one of these library privileges enabled:

  • “Add Content”
  • “Add Content On Behalf of Others”
  • “Manage Library”
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.