Questions tagged [contentversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
16
votes
2answers
9k views

Content Document download URL params

I spend hours to find a way to control download behavior of pdf-files (when to download and when to show inline) and did not find anything. What I got so far: the main thing that do all files ...
10
votes
1answer
163 views

SOQL: (WHERE x IN(a,b)) does return 2 records, but (WHERE x = a OR x = b) returns only 1 record… Why?

I'm trying to retrieve some ContentVersion records, but I'm having a lot of issues with it. After some research it seems as if the records are divided into two 'sets' as it were, and Salesforce in ...
8
votes
3answers
12k views

ContentDocument parentId

I am uploading a file via the Files related list on the Contact detail page. When I query (SOQL) the database I see the relevant ContentDocument and ContentVersion records. I would like to get the ...
8
votes
4answers
7k views

Isn't ContentVersion 'VersionData' Updateable (Amendable)?

I'm developing an file (attachments/contents) upload app and the process of my upload is that I upload file in chunks to ensure I'm not hitting view state. For first chunk insert new attachment ...
8
votes
2answers
578 views

Query Chatter Comment Files for a group of records

My question is similar to this one except that I need the files for a group of records, making the solution of querying ContentDocumentLink unworkable, because it requires a single Id for the where ...
8
votes
0answers
91 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): ...
7
votes
1answer
1k views

Visualforce: Why the display of an PDF-File inside an IFRAME works on a Sandbox but not in Production?

On a Visualforce page I have an IFRAME like this: <iframe class="viewer" src=""></iframe> It starts up an shows nothing because src is blank. Good. To store the actual PDF I upload it as ...
6
votes
1answer
4k views

How can I set the ContentVersion.FileType when creating new File via Apex?

I'm working on a webservice to create new Salesforce Files. To validate the underlying methods, I manually uploaded a PNG file, which shows up in the file preview in Files. I can retrieve the ...
6
votes
7answers
10k views

uploading files in contentVersion using lightning component

I am developing a lightning component to upload files in the contentVersion object. I used this site as a reference: http://peterknolle.com/file-upload-lightning-component/ I was able to ...
6
votes
2answers
175 views

Query optimization for ContentVersion

For a project I wrote a query to get all needed ContentVersion records. But after the deployment to full sandbox we have seen the performance issues with it. It only happens for the first time, all ...
6
votes
1answer
1k views

Files: Why ContentVersion /sfc/servlet.shepherd/document/download/ sometimes sets Content-Disposition=attachment and sometimes =inline

I need to view and PDF file stored as an attachment inside an IFRAME in this context: Visualforce: Why the display of an PDF-File inside an IFRAME works on a Sandbox but not in Production? Inspecting ...
6
votes
0answers
5k views

Best approach for uploading to Salesforce files via a Salesforce API

I need to load files into Salesforce via an API as part of some integration work. I want to be loading files as Salesforce Files (not attachments) so we can version files if need be and I also need to ...
6
votes
1answer
1k 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/...
5
votes
2answers
5k views

Trigger on ContentDocument not working

I am trying to setup triggers on ContentDocuments. The following link says that this is possible https://developer.salesforce.com/releases/release/Spring12/contentdocument+triggers I am able to ...
5
votes
2answers
4k views

Can't we query ContentVersion to get the file posted on the Object?

We have VF page that allows a user to upload an attachment that we later convert to FeedItem. THe VF Page also allows updating the FeedItem by inserting a new ContentVersion. The whole thing works ...
5
votes
2answers
720 views

Can't pinpoint what is causing DUPLICATE_VALUE error on contentDistribution insert

I have a custom app that is used for scheduling face-to-face trainings. I'm trying to set up a class that will run daily to gather all trainings scheduled for the next two weeks, and send out ...
5
votes
1answer
1k views

ContentVersion Reasonchange not updateable?

I have a before update trigger that I want to use to capture updates to previous version records in the contentversion. I want to add additional text to the reasonchange that was added by the user ...
5
votes
0answers
149 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: ...
4
votes
1answer
5k views

A link to Content documents from a VF page

I am managing my document in SF content library. I want to include a link to some documents in a VF page BUT I don't want the link to open the document preview on the Content tab. I would like the ...
4
votes
2answers
190 views

PageReference to Libaries page clearing my search

I have a Visualforce page that renders part of library content in it, but I also give them the option to type in a search which will renavigate them to the default Libraries tab with the search option ...
4
votes
1answer
2k views

How to upload an Excel file into ContentVersion Object

I need to upload an Excel file on an opportunity. I want to user ContentVersion standard object to store these excel files. Can anyone please explain or share a code snippet to show how can we ...
4
votes
1answer
178 views

How to download files, documents (attachments) in salesforce via apex?

I want to download all files associated with records (single or multiple records) of a particular object at one click, using apex. Let's say that there is a custom object myVehicle which holds ...
4
votes
1answer
140 views

Getting ContentType for ContentDocuments?

The ContentDocument and the ContentDocumentVersion do not store a ContentType (MIME) like attachments did. I am trying to pass documents using an API and this information is needed to properly pass ...
4
votes
1answer
396 views

Is it possible to update “Featured Content” in Salesforce Content?

Featured Content is a neat way to promote certain items in SFDC Content. From the documentation: Featured Content This section lists the five pieces of content in your libraries most recently ...
4
votes
1answer
1k views

Apex conventversion.VersionData chunk?

We are querying for contentversion data in apex and would like to take the first part of the file data and send chunk by chunk to another webserver. Is there a way to only take 10,000 bytes of the ...
4
votes
3answers
2k views

Problem trying to upload ContentVersion from base64 image data via REST API

I am trying to upload a small image in base64 as a Chatter file (ContentVersion record where Origin = 'H') via the Force.com REST API. Here are the headers and body that I am sending: https://gist....
4
votes
2answers
1k views

Visualforce Pages in Object specific actions

I have a simple vf page that just calls a controller's method on the action attribute <apex:page standardController="C_Object__c" extensions="Ext1" action="{!method1}"> <apex:...
4
votes
1answer
765 views

ContentDocumentLink

We have this record in Salesforce with Files attached to it. When I execute this query as an administrator via the developer console, it gives me results: [SELECT ContentDocumentId, ...
4
votes
1answer
1k views

Salesforce ContentDocumentLink public guest user

I have a few documents uploaded to salesforce files and i have a force.com site with the public guest user profile. When i enter my force.com domain my visualforce page queries for ...
4
votes
1answer
2k views

Querying For ContentVersion with ContentDocument Ids

I am trying to query ContentVersions based on the related ContentDocument Ids and getting 0 results returned even when the user can access the file in the user interface and there is a ...
4
votes
1answer
468 views

SOSL Filter by Library on Salesforce Content

Is is possible to search Salesforce Content in a specific library (ie. ContentWorkspace)? According to the Content data model, it seems the relationship between ContentWorkspace and ContentVersion ...
4
votes
0answers
489 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 ...
4
votes
0answers
663 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:- ...
3
votes
2answers
7k views

ContentPublication limit exceeded

Is there a limit on the content publication ? Is this the same as content version? The docs say "The maximum number of versions that can be published in a 24-hour period is 5,000. " Does this ...
3
votes
3answers
3k views

File Attachment not working when attaching crm Content

I have a page where the user selects content (that is 5MB or lower, only 2 attachments allowed per email) to use as an attachment in an email. It all seems to work fine, the email sends and there are ...
3
votes
2answers
2k views

SOQL ContentDocument: Ids not returning

A handful of our users have created notes on contact and opportunity objects that we are trying to port over. They are currently saved as ContentDocuments - but I also want to pull what objects the ...
3
votes
1answer
3k views

ContentVersion Content-Type

I need to stream a file from Salesforce in our webapplication. To make sure the file is properly opened, I have to set Content-Type header. How to retrieve the Content-Type (MIME) of a file? I ...
3
votes
1answer
316 views

Body not a variable of ContentVersion?

I am drafting up a couple of unit tests for this code. Here is what the code looks like so far: public class ContentController { public ContentController() { file = new ContentVersion(...
3
votes
1answer
597 views

Developer org needs Salesforce Content License

I'm trying to insert a ContentVersion item as follows: string before = 'Testing base 64 encode'; Blob beforeblob = Blob.valueOf(before); ContentVersion v = new ContentVersion(Title='New Document',...
3
votes
1answer
4k views

Upload file and attach it to contentDocument

I'm trying to develop a functionality that upload files and attach it to my opportunity ContentDocument (and not attachment) like my standard component do . I'm wondering when i'm saving my uploaded ...
3
votes
1answer
993 views

Apex Query on ContentVersion object and get all record

Apex Query on ContentVersion object and get all records, but the record are coming on current login user owned, not all records are coming. for example i am login with administrator account and want ...
3
votes
1answer
533 views

ContentWorkspace Permission And Migrating

I am working on an instance that has a large set of ContentVersion data uploaded by Customer Portal Users and saved across many ContentWorkspace(s) or Libraries. We have encountered some issues ...
3
votes
1answer
756 views

Adding Delete button to custom list controller for ContentVersion

I've been trying to have this code done with and finished for ages, and everytime I think I'm done, the person who wanted the code always adds an extra feature he'd like added in last minute. :T In ...
3
votes
0answers
186 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 ...
3
votes
0answers
199 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 ...
3
votes
0answers
573 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 ...
3
votes
1answer
124 views

Is there a limit for number of content folders?

I am getting this error when I try to create a content folder using a visual force page(by inserting a record in contentfolder. As per this link, there should not be any limit for the number of ...
3
votes
0answers
953 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. ...
3
votes
1answer
998 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 ...
2
votes
6answers
3k views

Exporting Content from Salesforce

I would like to export ContentVersion with real content file. We want to migrate content from Salesforce to another system for a single library. So, is there any way we can export data for a single ...

1
2 3 4 5 6