1

I have a trigger which create content Distribution Records. Creating content distribution Record using following code:-

ContentDistribution cdist = new ContentDistribution(
                    Name = cv.ContentDocument.Title,
                    ContentVersionId = cv.Id
                );
Insert cd;

I am getting following error while trying to save a file.

Insert failed. First exception on row 6; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

On debugging code I found out that error is coming when we are creating content distribution records.

I was thinking this might be a permission issue so I have given following permission.

I have enabled the permission "Content Deliveries feature can be enabled for users, Public Links can be enabled for users (Requires Content Deliveries), and Content Deliveries and Public Links can be enabled to let communities users share files managed by libraries (Requires Content Deliveries)." with help of this Doc. https://help.salesforce.com/articleView?id=content_delivery_about.htm&type=5

With above permission there is a help icon saying "Allow content deliveries and public links to be enabled for community users to share library managed files inside and outside the community. Users need the Deliver Content library perm enabled in the relevant library. To create public links, users also need the Create Public Links user permission."

I have created a permission set with Create Public links permission. I am not able to find how I can enable "Deliver Content library perm enabled in the relevant library" this permission in library.

Is this error is due to permission or I am missing something else.

The code is running in managed package. It is working for other customers.

4
  • I followed the answer mentioned below, but still getting the same error, did your issue fix? – gs650x Jul 4 at 8:13
  • @gs650x yes that fixed my issue. – Manjot Singh Jul 4 at 11:56
  • I have posted a question regarding my issue, would you please take a look and suggest what am I missing? – gs650x Jul 4 at 12:10
3

To enable Deliver Content from the library:

  1. Enable Content Delivery function for the org and Create Public links for the profile/permission set.

  2. Change to Classic

  3. Enter Setup

  4. Expand Customize->Salesforce Files

  5. Select "Content Permissions"

  6. Edit the "Author" or your custom Library Permission

  7. Check the "Deliver Content" checkbox

  8. Save...

1
  • I am getting the same issue, and I have done the same but still it is not fixed. – gs650x Jul 4 at 8:12

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.