Skip to main content

Questions tagged [contentversion]

129 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
9 votes
0 answers
1k views

Are ContentVersion unit tests impossible using a Community user?

I have some unit tests that pass when using System.runAs with standard user but fail when using Communities user. The error is (note the mention of NetworkId): ...
Keith C's user avatar
  • 137k
8 votes
1 answer
608 views

How to detect a size change for a ContentDocument or a ContentNote in a trigger?

Both ContentDocument and ContentVersion have a ContentSize field documented to be: Size of the document in bytes but after adding debug code to check that field for both types for these events: ...
Keith C's user avatar
  • 137k
7 votes
1 answer
4k views

ContentVersion custom field permissions

I have added a custom field to my ContentVersion standard object. Community users are uploading files, but I do not want them to be able to view or edit the new custom field. I cannot find where do ...
Itai Shmida's user avatar
  • 5,065
6 votes
0 answers
2k views

What Does the IsMajorVersion Field on the ContentVersion Object Do?

I referred to this documentation. The description for IsMajorVersion is: "true if the document is a major version; false if the document is a minor version. Major versions can’t be replaced.&...
Gabriel Rivera's user avatar
6 votes
1 answer
3k views

unable to view contentversion file as public site user

I'm utilizing the following URL to load an image stored as a ContentVersion file in an IMG tag. It loads correctly in SF but not on the force.com public site: /sfc/servlet.shepherd/version/...
Phil B's user avatar
  • 5,046
5 votes
0 answers
1k views

How can you insert a Salesforce File with Collaborator ShareType?

I am currently trying to insert a Salesforce File attached to a custom Invoice object with the Collaborator (C) permission, as described on the Salesforce Documentation. The code was originally set ...
salesForceNoob's user avatar
5 votes
0 answers
2k views

ContentPublication Limit exceeded in Unit Test

I have Apex triggers on ContentDocument and ContentDocumentLink Sobject. I wrote my Apex Unit Tests for those triggers and I was creating more then one Content Data record to test the Logic in Bulk. ...
MarcoDev's user avatar
  • 181
4 votes
0 answers
71 views

ContentVersion queries omitting recent records unless queried by an ID field

We are seeing a very strange behavior in a Summer '21 sandbox. Queries for ContentVersion will not return "recently" created records, unless queried by an ID or relationship. For example: ...
Jason Clark's user avatar
  • 12.1k
4 votes
2 answers
690 views

How to replicate the functionality of delivered "File Engagement" lwc card?

In our org we have a need to programmatically replicate the functionality of delivered “File Engagement” component/card. Here is a snapshot from our live org, on a ContentDocument view page: Since ...
kivanconer's user avatar
4 votes
0 answers
2k views

ContentVersion.VersionData or ContentDocument.LatestPublishedVersion.VersionData doesn't return the base64 body

We're using mobile SDK and want to retrieve the SOUP of ContentVersion bodies(VersionData) to be able to generate the images when our users are in offline mode. According to the documentation about ...
Taras Buchynskyi's user avatar
4 votes
0 answers
786 views

AfterInsert Trigger on ContentVersion addError not working

In Apex using a AfterInsert Trigger on ContentVersion (cv) object, the method cv.addError ('Custom message') is not working as expected. Instead of showing the custom error message the error that is ...
Saroj Bera's user avatar
  • 14.8k
4 votes
0 answers
968 views

When using the /sfc/servlet.shepherd/version/download/<VERSION> url hack to download all related Files, can we rename the zip?

So I've been using the /sfc/servlet.shepherd/version/download/ url method to create a button to download all files related to a record. However I was wondering if there is a way to rename the zip file ...
rna7's user avatar
  • 347
4 votes
0 answers
1k views

Custom field on ContentVersion returning 'NULL' in SOQL even value is assigned into the custom field

I created a custom field lookup of "Account" on "ContentVersion" object, and I wrote a trigger on ContentVersion that will assign "Account" field with a specific Account. Trigger is like this:- ...
Imran Qureshi's user avatar
3 votes
0 answers
74 views

Why doesn't ContentVersion Query doesn't respect OFFSET when you include VersionData?

I have some code where I have to be careful about how much ContentVersion data I load into memory at any particular time to avoid blowing the heap limit. I was planning to do an initial query on ...
Aidan's user avatar
  • 14k
3 votes
0 answers
146 views

Mismatched LInkedEntityId on ContentDocumentLinks

I'm trying to link attachment files to Salesforce EmailMessages. Steps so far: Upload attachment file by posting to /services/data/v58.0/sobjects/ContentVersion. Query ContentVersion table to get ...
Alex's user avatar
  • 31
3 votes
2 answers
4k views

How to upload a file to an external data source (e.g. Sharepoint, Google Drive, etc) in Salesforce via Files Connect

How do you upload a file to an external data source (e.g. Sharepoint, Google Drive, etc) in Salesforce via Files Connect? Is this even possible. I've read the Salesforce articles, I've watched a ...
Bob's user avatar
  • 131
3 votes
0 answers
960 views

Is it possible to download archived contentversion or contentDocument

I am having a hard time downloading a contentversion/contentdocument where contentdocument is already archived. I am trying to download the file by hitting rest endpoint services/data/v44.0/...
lambad's user avatar
  • 385
3 votes
0 answers
792 views

Trying to save image from Twilio MMS to Files?

I've built an SMS/MMS Lightning Component, which displays incoming MMS images in a thumbnail, and if you click it, a full-size modal display. Now I want to add the option to Save to Files... For the ...
PatMcClellan__c's user avatar
3 votes
1 answer
1k views

Updating Content records with dataloader

I'm trying to update detail fields on Content records using the Salesforce data loader, as well as dataloader.io. Typically, the uploads have failed w the message "ERROR: You do not have the level of ...
Sam R's user avatar
  • 31
2 votes
0 answers
59 views

Content Version before trigger data inconsistency issue

I have a before update trigger on content version to update the data of notes object in apex . It is working sometimes but sometimes in the before update the new updated value is not showing . For now ...
NewBaySales's user avatar
2 votes
0 answers
164 views

Connect API - set ContentVersion custom field on file upload

I'm trying to upload a file with the following request: curl -H "X-PrettyPrint: 1" -F 'json={"title":"BoatPrices"};type=application/json' -F "fileData=@BoatPrices....
Bart Juriewicz's user avatar
2 votes
0 answers
2k views

ContentVersion FirstPublishLocationId, specify ShareType `I`

If i create a ContentVersion e.g. via Apex like so ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; conVer.PathOnClient = fileName; conVer.Title = fileName; conver....
zaitsman's user avatar
  • 1,960
2 votes
1 answer
1k views

Delete a ContentDocumentLink of Library file

I have inserted a file in Library. I want to delete the ContentDocumentLink by which it is shared with the Library. I have created new ContentDocumentLink where I have shared file with a user. But ...
Ankit Semwal's user avatar
2 votes
1 answer
2k views

How to upload a Salesforce File using REST API properly?

GET /services/data/v47.0/sobjects/ContentVersion/0000v00000MFIVgAAP/VersionData from this request I will get binary file content, but how can I use this content to recreate the file properly (using ...
Pavlo Mykhailyshyn's user avatar
2 votes
0 answers
1k views

Is downloading multiple files officially supported by Salesforce in lightning?

The url "hack" to use /sfc/servlet.shepherd/version/download/ has been documented in a salesforce blog about visualforce pages showing images, however I can't find anywhere where this is officially ...
rna7's user avatar
  • 347
2 votes
1 answer
1k views

no preview for ContentVersion when inserting from Apex

I'm using the following code to generate ContentVersion. String title = 'sample file.txt'; ContentVersion contentVersion = new ContentVersion( VersionData = Blob.valueOf(...
ytiq's user avatar
  • 4,711
2 votes
0 answers
635 views

Cannot Query ContentDocumentLink as a Portal user

I have a situation where I am trying to retrieve documents which were generated by DrawLoop and added to SFDC as Files. As the System Admin user, I can query for this data using the following query: ...
Scott Cromie's user avatar
2 votes
0 answers
558 views

Rest API - Download times out without any errors

I am downloading ContentVersions through Salesforce using Rest API. I have submitted several file requests and downloaded. After downloading, an observation was that the ContentSize field in ...
dmachop's user avatar
  • 1,089
2 votes
0 answers
77 views

Why doesn't ContentVersion support getUpdated() or getDeleted() calls?

I'm working on backing up Documents, Attachments, ContentDocuments, ContentVersions. It seems that I cannot use getUpdated() and getDeleted() calls on ContentDocuments and ContentVersions. However, I ...
dmachop's user avatar
  • 1,089
1 vote
0 answers
159 views

Possible reason for inserting a ContentVersion causing a row lock error on ContentFolder?

I've got some code to insert a ContentVersion in a Queueable so that it can be read later by another Queueable or a Platform Event once all the files are prepared. The insertion is nothing fancy: ...
Aidan's user avatar
  • 14k
1 vote
1 answer
2k views

Import Files and Attachments to the ContentVersion object using CSV file and Dataloader

I am working on migrating files from an old SF org to a new one. I have done a data export on the required files and documents using the native Data Export tool in the Setup. That gave me the ...
Wesley Klein's user avatar
1 vote
0 answers
337 views

How to enable object SharingRecordCollection in sandbox?

Context To retrieve all applicable files in the org and perform a data migration on ContentVersion records, we have created a permission set with Query All Files permission (as recommended here) and ...
Shamina's user avatar
  • 4,502
1 vote
1 answer
498 views

Variable does not exist error while trying to set custom field on ContentVersion record

I'm trying to do something relatively mundane, which is store an offset value for Timezone on a custom field on the ContentVersion object. It seems like no matter what field I reference (including ...
api-testuser45690's user avatar
1 vote
0 answers
377 views

Display folders for an object according to a picklist value using lwc

Hi all I have an object name FS where I have uploaded various files in each records. Also in the content version record I have a picklist value named Category which has certain picklist values New and ...
user121495's user avatar
1 vote
1 answer
322 views

Uploaded audio file to salesforce ContentVersion getting corrupted

I need to upload a Zoom recording as ContentVersion to salesforce using the recording file donwload_url. What I've done so far is this: // Get download_url field from Zoom file returned by api const ...
letie's user avatar
  • 111
1 vote
0 answers
482 views

Prevent creating new file while uploading new file from Salesforce standard upload button

Whenever a user uploads a new file under a particular record, I need to check for an existing file with the same name. If there is an existing file, then it should not create a new document; instead ...
Ajith Kumar's user avatar
1 vote
0 answers
380 views

Field Permissions on ContentVersionHistory

I'm trying to display field history for some custom fields on the ContentVersion object. This object has some interesting properties, one of which is that field security cannot be explicitly set on ...
luckiestlindy's user avatar
1 vote
0 answers
3k views

Sending Files From Salesforce using REST

We have a process in which we need to send a JSON of leads every day to an external system (Not Salesforce). Until now we just created the JSON with the desired data and sent it via REST. From time to ...
Salvation's user avatar
  • 1,209
1 vote
0 answers
1k views

Pushing content version (>50Mb) via REST API

We are pushing / inserting files larger than 50Mb which is the reason we are using multipart messages to push the data and this is being done via node.js Now, the issue that I am facing is on the ...
Sam's user avatar
  • 4,383
1 vote
0 answers
1k views

Sub-query issue on ContenDocument and ContentVersion

I have a list of ContentDocument IDs which are all tagged to the same Sobject, when a ContentDocumentId is selected, I want to retrieve only its latest ContentVersion data based on the ...
Hengky Djapar's user avatar
1 vote
1 answer
5k views

How to create contentversion by using file url?

We want to create ContentVersion related to the account object. We have one field on account which contains the URL of the file(png/jpg/pdf). And by using that URL we want to create ContentVersion. ...
Darshana's user avatar
1 vote
1 answer
385 views

ContentPublication Limit exceeded in Test Class?

Is the content publication limit applicable to test class as well? All i am doing on my test class is to create a contentversion record. It still says that ContentPublication Limit exceeded. Does ...
Prady's user avatar
  • 12.4k
1 vote
0 answers
1k views

Inserting Content Version via Community User in test class Failing

I think this is very straight forward I just can't figure out the issue behind it. Error: : Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do ...
Snorlax's user avatar
  • 47
1 vote
1 answer
672 views

Upload ContentVersion to SF via JS

I am developing a visualforce page. I'm trying to upload pdf-file from remote server in contentversion , here is part of my code: let response = await fetch('http://www.africau.edu/images/default/...
Vladimir K.'s user avatar
1 vote
1 answer
150 views

Problem in Updating ContentVersion

I am trying to update contentVersion multiple times in code in same transaction. However unlike salesforce records (eg. Account) , contentVersion is holding only first updated value and only those ...
anonymous's user avatar
1 vote
0 answers
1k views

How do I customize the zip file name when downloading multiple files?

I know how to download a single file from salesforce. I just open a new tab with the url /sfc/servlet.shepherd/version/download/068xxxxxxxxxxxxxxx/. Likewise, I know how to download multiple files ...
Sullivan's user avatar
1 vote
0 answers
55 views

Get ConventVersionId via Connect API

So I'm circling back on a problem I tackled a few years ago, as I needed to update the Chatter API version that I'm using, and in doing so need to rework some code that touched the nasty hack in ...
Matt Lacey's user avatar
  • 25.8k
1 vote
1 answer
2k views

How to upload multiple files to ContentDocumentLink Object in one call from a lightning component?

I want to upload multiple files from a public site to salesforce ContentDocumentLink. How I can create bulk of files on javascript (client) side and handle them from apex? Lightning Component: ...
Alex Andreadis's user avatar
1 vote
0 answers
485 views

custom files related list component not reflecting new files upload

I have a custom lightning component that displays further details from the contentVersion. the customer requirement is to display both, the standard files related list and my custom cmp. now, when the ...
yuval boim's user avatar
1 vote
0 answers
218 views

Translate IsPrivate check into Enhanced Notes

I am migrating notes into Enhanced Notes, How do I move the IsPrivate(Checkbox on Notes) values into Enhanced Notes? If the IsPrivate Checkbox is checked on Notes, how can I do this on EnhancedNotes?
manjula's user avatar
  • 11