douglascayers / sfdc-convert-attachments-to-chatter-files

📎 Easily migrate your Attachments to Salesforce Files.
https://douglascayers.com/2015/10/10/salesforce-convert-attachments-to-chatter-files/
BSD 3-Clause "New" or "Revised" License
73 stars 29 forks source link

Issue Converting on Guest User Account? #32

Closed amessineo closed 6 years ago

amessineo commented 7 years ago

Hi Doug,

Thanks for the great tool!

We have a conversion that fails (using the trigger) each time an attachment is added. We have a Salesforce Site which allows the user to add multiple attachments on the visualforce page. When then get added to the created case, they trigger the following conversion error in the log.

Error:
Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator.

A couple things:

Note: I do not have the following setting enabled right now. Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments

Any idea of how to fix this?

Thanks so much! Anne-Marie

douglascayers commented 7 years ago

Hi @amessineo,

Thanks for the details. Hrmm... do your errors mention any class names or line numbers?

In the 1.1 version of the code, the only place I query for ContentDocumentLink in the conversion service is at line 228, but it filters by LinkedEntityId.

I wonder if that error message is a red herring and the issue is perhaps actual permission or licensing with the community user?

I have a unit test that I think is testing for this scenario, maybe not. Hrm.. well, my test asserts a Partner Community User can save attachments but not necessarily the Guest Site User.

What User License Type does your "Guest Site User" have?

Thanks,

Doug

amessineo commented 7 years ago

Hi Doug, Here's the license type. User License | Guest License

These Guest accounts are be automatic created when an external Force.com Site (one our customer user) is created. https://help.salesforce.com/articleView?id=000006778&type=1

We find out about the error about the issue by email.
Subject: Errors: Convert Attachments to Enhanced Attachments Errors have occurred. Please review the log records for more details

Example of the error log Log Number | 000086 |   |   Job ID | 7070e00003Yo4ZUAAZ |   |   Log Time | 8/2/2017 10:45 PM |   |   Summary | Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator. Detail | (dca_cnvrt_file)

It could be that it doesn't have permission to query the list of created files, causing the error. (?)

douglascayers commented 7 years ago

Thanks @amessineo for the follow up. I'll do some testing on my end. My hypothesis is that Guest License may be too limited, or perhaps there's a CRM Content setting somewhere we need enabled or granted to the Guest Site User.

douglascayers commented 6 years ago

Hi @amessineo,

Sorry for the delay, I've identified the issue and have fix coming in the next release that will be published this weekend.

Thanks for your patience and for reporting the issue!

Doug