function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nick VerschuerenNick Verschueren 

One user can't create ContentVersion

We have a script that does a HTTP callout to create a PDF, the callback saves this PDF in Salesforce as a document.

We have this working for multiple objects and this works fine. But for one type, one user, has an error that we can't seem to resolve.

The user is a System admin, other system admins can run it without issues, even profiles with less rights (sales user) can run it without issue.

But whenever this user runs it, he gets this error that we don't understand:
 

System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, common.exception.SqlNoDataFoundException: ERROR: query returned no rows
Where: PL/sdb function doc.contentfolders.get_root_fdr_details(character varying) line 16 (SFSQL 286) at SQL statement
SQLException while executing plsql statement: {?=call ContentFolders.get_root_fdr_details(?)}(07H09000000D1Dj)
SQLState: P0002
Where: PL/sdb function doc.contentfolders.get_root_fdr_details(character varying) line 16 (SFSQL 286) at SQL statement
File: plsdb_exec.c, Routine: exec_stmt_execsql_body, Line: 3307
[conn=STANDARD:1:1:108918:1]: []
Class.HttpCallout.processContract: line 77, column 1
the code it fails on is this:
Callout calloutObj = (Callout)JSON.deserialize(calloutString, Callout.class);

HttpRequest req = setupHttpRequest(calloutObj);
HttpResponse res = makeRequest(req);

Quote q = [SELECT Name FROM Quote WHERE Id= :recordId LIMIT 1];
ContentVersion conver = new ContentVersion();
conver.ContentLocation = 'S';
conver.PathOnClient = 'Contract.pdf';
conver.Title = 'Contract_' + q.Name;
conver.VersionData = res.getBodyAsBlob();
conver.Type__c = 'Contract';
insert conver;  <=== Line 77

As I said, works fine for everyone, but this one specific user we get this error. 

Anyone an idea how to fix this? We don't even understand the error completely...
Best Answer chosen by Nick Verschueren
Bryan Leaman 6Bryan Leaman 6
Can that user upload files using the normal salesforce user interface? If not, it looks a lot like an issue that requires a call to salesforce support for them to apply a known fix. See this article:
https://issues.salesforce.com/issue/a028c00000prX8dAAE/unable-to-upload-files 

All Answers

Bryan Leaman 6Bryan Leaman 6
Can that user upload files using the normal salesforce user interface? If not, it looks a lot like an issue that requires a call to salesforce support for them to apply a known fix. See this article:
https://issues.salesforce.com/issue/a028c00000prX8dAAE/unable-to-upload-files 
This was selected as the best answer
Nick VerschuerenNick Verschueren
Yes this seems to be the exact same problem, I tried uploading a file manually with the users account, and this failed as wel. I have logged a ticket with Salesforce Support as per directions in the link you provided.
Thanks a lot!