Questions tagged [contentversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
0answers
124 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: ...
0
votes
1answer
360 views

How to import contentversion records(csv file) using dataloader

i have three records in csv file and three pdf files. how can i import these content version records to sandbox. i tried, but when i am uploading csv file using dataloader, i got Required fields are ...
1
vote
0answers
100 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?
4
votes
0answers
383 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 ...
0
votes
2answers
49 views

Trigger Cant see files not shared with running user

I have a trigger that counts attachments and files on an opportunity and rolls this up to the opp. However the trigger only sees files that are shared with the user that is executing it Is there a ...
0
votes
2answers
404 views

Retrieving VersionData with standard REST API

I am trying to retrieve VersionData with a standard REST API call from a VisualForce Page a then upload it to a S3 bucket but end up with corrupted files. I believe this is an encoding problem on the ...
1
vote
1answer
465 views

Upload large ContentVersion records

I'm using a @RemoteAction to upload files to Salesforce, saving them as ContentVersion (Chatter files). I'm uploading the base64 Blob of the file. This works great for small (<1MB) files. I am NOT ...
4
votes
1answer
98 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 ...
-1
votes
1answer
320 views

Get Id of Files record

Is it possible to get the ID of a file that has been attached using Files. Below is a picture and when hovering over the download link, it display the id. As seen above, the id of the attached image ...
1
vote
1answer
1k views

Displaying image in Visualforce PDF

I am trying to display an image in my PDF but am unsuccessful. I am using files to attach the images. Can someone please find out where I am going wrong? Apex code: public class findImageAttach { ...
0
votes
1answer
399 views

How to Upload ContentVersion into OneDrive using Apex?

I am unable to send a png file from Salesforce ContentVersion to Microsoft OneDrive. Below is my code: for (ContentVersion cv : ListFilesToBeUploaded) { Http http = new Http(); httpRequest ...
1
vote
1answer
359 views

Insert base64 string as attachment using apex dataloader

I have a .csv file which has a column containing base64 string equivalent of a image. Anyway we can load the csv file into Attachments object or ContentVersion object using apex dataloader? I know if ...
2
votes
2answers
2k views

Issue Setting ContentVersion Owner

I am getting an attachment via a Salesforce email service and in the Email service apex class logic, I query the user object by the email from address and set the ContentVersion owner as the user ...
1
vote
1answer
652 views

Trigger on Notes (lightning)

Requirement: If a note is added to either an account, contact, opportunity, task and event for particular record types and the current user is not an administrator and not a user mentioned in system ...
1
vote
1answer
234 views

Is there any way to get or edit the metadata in images posted to salesforce?

Is there a way through apex or using the VersionData of the ContentVersion for me to change that EXIF data of a ContentVersion image so that it won't register as needing to rotate? To be more ...
1
vote
1answer
414 views

Knowledge Articles in Communities Custom VF + Tabs

We are currently building a community using VF together with bootstrap to achieve the clients requirements with regards to Design. We are using KnowledgeArticles in a section and wanted to achieve the ...
1
vote
1answer
4k views

How to get ContentDocument file body blob in APEX

How to get ContentDocument file body blob in APEX. We can query ContentVersion but it give result like It gives some URL but I need blob of body. How can we get them.
3
votes
2answers
1k 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 ...
0
votes
1answer
233 views

Query to retrieve certain files from Product2

I have the following use case: A web shop (Java) retrieving products from SF using the SOAP API. Attached "Files" are retrieved and displayed by selecting them through ContentDocumentLinks related to ...
0
votes
2answers
89 views

Unable to revise ContentDocument created in Apex

When I try to create a Content Document (File) in apex, it creates one with no facility to revise or add new version. However if I use the UI to create a file it gives me a link to add new version. ...
6
votes
0answers
4k 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 ...
1
vote
0answers
1k views

ContentVersion trigger event AfterInsert -> Insert ContentDocumentLink -> FIELD_INTEGRITY_EXCEPTION

We need to get a solution / workaround to insert in ContentDocumentLink several links when a File that has just been inserted (ContentVersion) and sibling records of other Custom Object. A third ...
2
votes
1answer
4k views

How do I create a new ContentDocument Version in apex?

I'm getting insufficient privileges error when I try to create a new version for an existing file in apex. Code used to create new version: ContentDocumentLink cdl = [SELECT ...
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 ...
0
votes
1answer
273 views

Contentversion getBodyAsBlob issue

I'm tried to insert contentversion record from API response. In response getting PDF only. I've tried below code but i'm having issue in previewing the file. ContentVersion cv = new ContentVersion(); ...
1
vote
1answer
2k views

Content Document Link: FIELD_INTEGRITY_EXCEPTION, Document with ID: *** is already linked with the entity with ID: ***: Linked Entity ID:

I have a trigger on contentversion object which inserts contentdocumentlink to share files specific user whenever a new file is uploaded. If I try to upload a new version to already existing file, I ...
-1
votes
1answer
543 views

How to find a user uploaded .txt file by name and get the text in my Apex Class?

I will have users upload a .txt file in the Salesforce Files uploader (shared to a particular group). Then, I want to access the text of that file within my Apex Class to do something with it. I'm ...
-1
votes
1answer
237 views

Add a version of file to a existing file version(ContentVersion)

I am trying to attach a versions of file with content Versions to a existing content version, i don't know how to do that... actually i arrive to insert file but some duplicate file is present and i ...
4
votes
1answer
599 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, ...
1
vote
1answer
720 views

Scheduled Data Export: how to obtain ContentVersion linking data

I've used the Data Export feature to pull down ContentVersion data for Files and (Enhanced) Notes from a Salesforce org that's being migrated into a different org. I've been unable to locate the ...
3
votes
1answer
205 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(...
10
votes
1answer
6k 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 ...
0
votes
1answer
2k views

Create a ContentVersion document available for all users

Sorry if this seems easy, but I am new to Salesforce... What I did so far is: Query files using apex Do operations according to VersionData of queried files Everything works as expected. However, ...
0
votes
0answers
458 views

Convert legacy attachments into the files

I need help to convert legacy attachments to files with lastmodifieddate of file is equal to created date of attachments by using apex code. I need to do it for all objects on which attachments are ...
0
votes
0answers
55 views

How to restrict specific profiles to create note

I need to restrict users with a specific profile to create Note in Salesforce for under lead object. I know that Note object will inherit access level from parent Lead. I need lead to be accessible ...
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 ...
0
votes
1answer
2k views

Download and save contentVersion file JAVA

Please help me with download contentversion of PDF and save to file in java. I have a problem with base64. RestAPI return content in base64 but when I save it to file I have a blank page when I ...
3
votes
1answer
93 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 ...
1
vote
2answers
1k views

I want to associate File With Custom Object but getting Error

I am trying to create new File through ContentVersion and Associating it with Custom Object ParentId is ID of Custom Object . Error given is Document: You cannot create a link for a document in a ...
2
votes
2answers
547 views

Specify ContentSize when creating new ContentVersion in UnitTest

I used the post: Test class for contentdocumentlink as a model, however, when I attempt to define my own ContentSize for the ContentVersion document I receive: Field is not writable: ContentVersion....
0
votes
1answer
231 views

AJAX attachment upload, bad field ParentId

I have a project to upload some files for both licensed users and portal users. Got it working 98%... except for portal users.. mama mia... I created a site off a domain, logged in a user and ...
2
votes
1answer
273 views

Add opp id field into ContentVersion Post Insert

i am trying to add the opp id for a content version to the content version once it is created i am running into issues where the record is read only, how can i update this object when it seems to be ...
2
votes
1answer
2k views

Size limit on ContentVersion object in Salesforce

I was trying to create and insert a ContentVersion object in Salesforce lightning(for file upload) using the following code: ContentVersion v = new ContentVersion(); v.versionData = ...
0
votes
1answer
748 views

Document and ContentVersion

I am trying to understand the relation between documents and contentversion. When i queried documents, it returned 100+ records but when i queried contentversion it returned only 1. Please help me ...
0
votes
1answer
387 views

Ability to access 2GB files for external system

I am trying to grab large VersionData from ContentVersion for a REST service but HTTPCallout and HttpRequest only allows 12MB (Async). How can I get access to the 2GB files? Would that be through ...
6
votes
1answer
935 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 ...
7
votes
1answer
821 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 ...
0
votes
1answer
968 views

Insufficient Privleges while delivering content

I am having trouble delivering an existing content file. I am unable get any of files while performing a search. I am able to deliver content if i am uploading the file instead of searching for it. It ...
1
vote
0answers
384 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: ...
0
votes
1answer
2k views

Not able to create ContentDocumentLink from sforce ajax

I have followed this to create a content version from vf page using sforce ajax and it is working fine. To link the uploaded content to one of my custom object I added the below code; var result1 = ...