Salesforce Fact #776 | Error while deleting file association with library

Have you encountered this error:  Cannot complete this operation. You cannot remove a document from its owning library.

So, whenever we associate a file to a library, a record gets created in each of ContentWorkspaceDoc and ContentDocumentLink objects. If we try to delete any of these records, it throws the error.

So, the file or the ContentDocument record itself needs to be deleted to delete the associations.

Reference: https://salesforce.stackexchange.com/questions/317241/delete-a-contentdocumentlink-of-library-file

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow