+ Start a Discussion
phil.vaseyphil.vasey 

Deleting a FeedItem containing a PDF document inserts a new ContentDocumentLink

 

I can supply code if you wish, but here is my problem:

 

  1. Create some host record
  2. Create a FeedItem on that host record with a DOCX content
  3. This creates TWO ContentDocumentLink records; one linked to the host record and one linked to the User
  4. Create another FeedItem on that host record with a PDF content
  5. This creates another TWO ContentDocumentLink records
  6. Delete the host record with a trigger that deletes its FeedItems and also deletes their ContentDocuments

The DOCX ContentDocument has gone, but the PDF ContentDocument is still there.

 

The original ContentDocumentLinks for the PDF have gone, but a new ContentDocumentLink record linked to the User has been inserted (different Id).

 

Can anybody explain why this new link is inserted?

 

Furthermore, even with admin permissions, this new link cannot be APEX deleted (FIELD_INTEGRITY_EXCEPTION).