New answers tagged

0

Adding onto @Sanket answer because i struggled getting this right initially. This needs to be ran After Insert on a Content Version Trigger. After grabbing all of the content version contentDocId's i threw it into this method. i would suggest switching this to @future and dropping the return, but that is up to you. public static final String SNOTE = '...


0

If you want to maintain the file versions, simply insert another ContentVersion record with the same ContentDocumentId. It won't be creating a new file, instead it would create a newer version of the file. Do not create another ContentDocument and ContentDocumentLink. Otherwise, upsert the ContentVersion will do. Sample Code: String title = 'Goldstar ...


-1

you can use upsert operation, instead of insert operation ContentVersion contVer = new ContentVersion(Title='Goldstar Request '+this.catrequest.Account__r.Name + ' ' + this.catreq.Name , VersionData = body, PathOnClient ='/Catalog.pdf'); upsert contVer; note: i am assuming u have null check in place , use size method before dml operation


-1

I am not sure why this doesn't give me correct data but I have found a work around. I am using fetch-base64 package to make request to this particular URL. I am passing the correct authorization header along with the request. const doFetchRemote = await fetch.remote({ url: instanceUrl + contentVersionObj.VersionData, headers: { '...


1

The "incomprehensible junk" is the actual binary content of the file. The URL that you receive in ContentVersion's Body field is an sObject Blob Retrieve endpoint. From that documentation: Because blob fields contain binary data, you can't use JSON or XML to retrieve this data. There's no need to perform Base64 decoding because you are directly ...


0

Would calling the Apex EncodingUtil.base64Encode on it work? I have used that for other issues with Blob to string conversions. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_encodingUtil.htm


0

So may be the app named 'Einstein Playground' is somehow changing the blob data of 'einstein_platform.pem' file after uploading when uploading through the app. Uploading the same file outside of the app is okay and fine. update : Now I have download the file 'einstein_platform.pem' uploaded through the app and I can see that the file is corrupted. So, ...


Top 50 recent answers are included