cancel
Showing results for 
Search instead for 
Did you mean: 

Dedupe Files - Invalid Sharing Type Error

Murphybp79
Frequent Contributor

I was pleasantly surprised to find out I can use DemandTools to Dedupe and merge duplicate files (ContentDocument) that my users have uploaded.  It works really well when the same person uploads the same file multiple times.  However, if 2 different users upload the same file, I'm not able to dedupe and merge those as I get the following error. 

Error cloning record 06A6g000007ynorEAA: Invalid sharing type I

The 06A prefix is for the ContendDocumentLink object.  So I believe there is an issue happening when it's trying to add both users to the new document it encounters an error, probably because it's copying those records as is and they are both setup as Owners and you can't have 2 owners on 1 file, so.....errror.  I'm wondering if there is a way to get around this, or have it only add the user from the winning file?  

5 REPLIES 5

AnthonyValidity
Validity Team Member
Validity Team Member

Hi @Murphybp79 ,

I wanted to let the rest of our customers know that we decided on creating a ticket for this as it may be a Salesforce error, etc.

Regards, 

Anthony Lardiere Jr
Senior Customer Success Manager

CRMSarah
Frequent Contributor

Hi @Murphybp79 (@AnthonyValidity), this is in fact a Salesforce error. 

It usually sometimes occurs when Apex Triggers are on the ContentDocument object in Salesforce. Can you confirm for me that there's a Apex Triggers on that object? 

CRMSarah
Frequent Contributor

I would also run a query to see what the 'sharetype' is on some of these ContentDocuments. You'll want to run it off of the ContentDocumentLink object though to see the ShareType. Here's a query you can use: 

SELECT Id, LinkedEntityId, ContentDocumentId, IsDeleted, SystemModstamp, ShareType, Visibility FROM ContentDocumentLink WHERE ContentDocumentId = 'INSERT ID HERE'

I think that you'll want the ShareType to be C instead of "I" as this will give the most "open" permissions on the object. Once the permissions are wide open on both files, try to merge them again and see if that helps. 

For reference (and to double check my logic 😜)

V     Viewer permission. The user can explicitly view but not edit the shared file.

C     Collaborator permission. The user can explicitly view and edit the shared file.

I     Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined by the permissions the user has in that library.

 

Murphybp79
Frequent Contributor

@CRMSarah There are no Apex Triggers on the object.  As I stated in my post, the issue the fact that there are two different owners for the documents being merged.  The DemandTools Support team is investigating the issue. 

CRMSarah
Frequent Contributor

Feel free to disregard my messages, perhaps they'll help someone in the future who is experiencing a similar problem. I hope that you report back here to let us know what Support suggests.