Questions tagged [contentversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Inserting a ContentVersion using Angularjs $http + Chatter Rest API

I have been trying to insert files using Salesforce Chatter REST API, but its been documented only for curl. I am unable to find how to do the same in Angularjs using $http with visualforce. I am ...
0
votes
2answers
253 views

How to make a Salesforce file private using Apex

My requirement is to make a Salesforce file private using Apex. I tried to update the PublishStatus field (on ContentDocument), but this field is not writable. Any idea?
0
votes
0answers
27 views

All Files Link not visible in Lightning

We wanted to convert the Documents to Files as Documents are not available in Lightning. The Documents were created inside a folder and were shared with all the users hence, we wanted to provide same ...
0
votes
1answer
26 views

Can the owner of an attached file be set to a queue?

My app's users need to be able to view and edit each other's files that they have attached to records. So my idea was to put my users into a Queue and then set the owner to that Queue on upload. I ...
3
votes
1answer
2k 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 ...
1
vote
1answer
185 views

System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by a single… in test class?

I'm facing System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's ...
1
vote
1answer
252 views

How to make ContentVersion public using Apex

I want to make a ContentVersion record publicly available using Apex. I know I can get the DistributionPublicUrl value from the ContentDistribution object. But I don't know how I should configure ...
0
votes
0answers
87 views

Fail to save my file in contentVersion salesforce

I have some issue , saving the file uploaded in my salesforce contentversion via the button save . I did check my apex code and manually it works but when i use my save button it doesnt . My code is ...
2
votes
1answer
1k 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 ...
1
vote
0answers
24 views

INVALID STATUS on ContentVersion create from Attachment [duplicate]

I'm currently trying to create ContentVersion records from Attachment ones but it's giving me the following error: INVALID_STATUS, Documents in a user's private library must always be owned by that ...
-1
votes
1answer
72 views

restrict user to edit the notes using the trigger on ContentVersion

Please help me with this. trigger ContentVersion_PreventUpdate on ContentVersion (before update) { Schema.DescribeSObjectResult inv = customobject__c.sObjectType.getDescribe(); String invKeyPrefix =...
0
votes
0answers
41 views

No FirstPublishLocationId for a File after uploading a new version

I have a custom search component that queries ContentVersion for files that are associated with a custom object. The query uses FirstPublishLocationId to check if a certain field is set at the record ...
0
votes
2answers
83 views

Can two Case sobjects have the same child ContentVersion?

I am trying to delete a ContentDocument under Case sobject safely. In order to do so I will delete the Case's related ContentVersion's ContentDocument, which will delete the ContentDocument and its ...
0
votes
0answers
346 views

Add Upload File button to a custom object

I am working on an assignment where I built a custom object on top of files (ContentVersion, ContentDocumentLink, ContentDocument). Since the customizability of files is limited in Salesforce, we are ...
0
votes
1answer
174 views

Cannot able to get ParentId from ContentDocument

I have a below code to retrieve parentId of content document after insert on ContentVersion. //get blob body content from ContentVersion for(ContentVersion cVersion : [SELECT Id, versionData,...
0
votes
1answer
247 views

Could not able to retrieve VersionData from Content Version after insert of ContentDocument

I am trying to retrieve the body of ContentDocument after insert. Below is my code.My trigger is on ContentDocument (After Insert) public static void syncContentDocument(List<ContentDocument> ...
0
votes
0answers
43 views

Insert a record in custom object when attaching files in Salesforce

I am working on as assignment where I need to insert a record in a custom object (FileAttachment__c) when a file is uploaded under a Contact. When the file is uploaded, the custom object record needs ...
0
votes
0answers
47 views

Creating public ContentVersion via REST API on behalf of someone else fails

I am creating simple interface for posting new Case feed posts (FeedItem objects). These posts are created by admin on behalf of other users (altering the CreatedById field). I'd like to support also ...
0
votes
2answers
510 views

How to insert ContentVersion with preview in files?

I can insert an image, but it's without preview. I can open the image after downloading, but a need preview. It writes in files "No preview available". How to fix that? Here is my code. js: ...
0
votes
1answer
179 views

“No preview available” after uploading ContentVersion with Lightning

I get my test image in files, but can't to see the preview. How can I fix that? @AuraEnabled public static void save(String resumeId, String versionData){ ContentVersion ...
0
votes
1answer
35 views

Related Files Component

I have a component and apex controller that calls/displays all the related files on a record. How can I filter the returned files by a field that is set on ContentVersion? ie. only show files if ...
2
votes
1answer
965 views

How to upload a ContentVersion with lightning component?

I'm trying to use simple apex class and simple controller like a test. But can't upload ContentVersion. What is wrong here? handleFileSelected: function(component, event, helper) { let files = ...
0
votes
0answers
357 views

Insert ContentVersion without VisualForce

I've got a CSV file stored on the user's hard drive and I want to store it in Salesforce. The code I have uses Visualforce and Apex to, I think, open up the file and place the contents on a hidden ...
0
votes
2answers
163 views

Unable to get file attached to Account using Apex

I have a file firstname lastname cv.pdf attached to an Account record. I would like to get the file using apex, below is my attempt: List<ContentVersion> files = [SELECT Id, VersionData ...
1
vote
0answers
145 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 ...
0
votes
1answer
240 views

Salesforce Standard API - Composite Tree resource

In order to create record in bulk using REST API, we using Composite Tree resource. I'm trying to upload a bulk of content versions : {"records" :[ { "attributes" : {"type" : "ContentVersion", "...
1
vote
0answers
543 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 ...
1
vote
1answer
176 views

Salesforce Standard API - Content Version

I'm trying to send an array of content versions via the Standard API that Salesforce suggests : Using POST method to : https://SandboxName.my.salesforce.com/services/data/v43.0/sobjects/...
0
votes
0answers
126 views

Force.com upload file via API from guest user

I am building a visual force page that sends a file from the org to our 3rd party server that modifies the file as per instruction. So far that is working fine. I need to return that document from ...
1
vote
1answer
173 views

How to query contentversion to Email Message

We have integrated Salesfroce and our Support Page, and I have to send emailmessage via rest api along with attachment lies within the email, but I don't find a relateionship between Contentversion ...
3
votes
0answers
116 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 ...
1
vote
1answer
828 views

/services/data/v43.0/sobjects/ContentVersion rest api Limitation

I'm using the standard rest API that salesforce suggest for upload files : /services/data/v43.0/sobjects/ContentVersion - and converting the file to base64 blob on the VersionData param. I want to ...
1
vote
1answer
868 views

FIle upload to Salesforce FIles using custom REST API [closed]

I am getting an error response "system.limitexception:Json string exceeds heap size limit\n\nexternal entry point" when testing through postman, for file upload greater than 4 MB through custom Rest ...
0
votes
1answer
68 views

When converting Classic Notes to Enhanced Notes — what object do the Converted Classic Notes live on?

I can't find them on ContentVersion or ContentDocument. If I create a NEW Enhanced Note, those live on ContentNote. But what about the converted ones? They are no longer on the Note object either.
1
vote
1answer
285 views

Set SharingOption in ContentVersion throwing exception

Here is my code : contentV.pathOnClient='/'+contentV.Title; contentV.SharingOption='Restricted'; try { insert contentV; List<ContentVersion> listBid =[SELECT Id, ownerId, ...
0
votes
1answer
451 views

content version - clone from one object to another

I am trying to clone File(s) from a parent object to child. The code I am using is doing that but the file type is set to "LINK" while doing so, and I am unable to open that file or it has nothing ...
1
vote
1answer
35 views

What kind of test can I write to check the file?

I have a controller for VF Page. This code upload a profile's image (we can see it after that) and delete it. What kind of test can help me to check this file? I need to know, is it uploaded or not. ...
0
votes
2answers
161 views

Make the test work: File insert, check this File

This code is a controller for my VF Page. It inserts ContentVersion and ContentDocumentLink. After that a candidate field Photo__c take a ContentVersion.Id value. How to check it correctly? Now ...
0
votes
1answer
613 views

ContentVersion: how to check File Type and File Size?

I need to check Max Image Size and File Type so I can display the correct error in ApexPages.Messages. I tried to do something like this: if (conVer.FileType != '') But I don't know what FileType ...
1
vote
3answers
4k views

How to convert ContentVersion VersionData to String

How would I convert CSV data stored in the VersionData field of object ContentVersion into a CSV String. According to the documentation: ContentVersion The field VersionData is of type base64 So ...
1
vote
2answers
635 views

Unable to extract bulk ContentVersion and ContentDocumentLink data using Salesforce API

Use Case: Transfer existing (and OOTB) Files that are linked with couple of custom objects (CO 1 & 2) to another Custom object (CO X)? The new custom object (CO X) has look up fields for CO 1 &...
6
votes
2answers
148 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 ...
-3
votes
1answer
78 views

Need help for writting test class for method for extention controller [closed]

Sorry I am new with salesforce developer. I have written method for extension controller. I need help with writing test class for that method. with that method what it does is visualforce is renderas ...
0
votes
1answer
263 views

Not able to insert public group id as LinkedEntityId in contentDocumentLink object

I have written one trigger which makes file private on the creation and has another trigger which shares the file access to a public group, but the second trigger is not working since, when I try to ...
0
votes
0answers
315 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 ...
1
vote
1answer
802 views

ContentDocumentID is not available just after ContentVersion getting inserted But available after soql query

I am inserting ContentVersion as following:- String yourFiles = 'Lets assume this is your binary string of the files'; ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; // S ...
2
votes
0answers
335 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 ...
0
votes
1answer
31 views

Exporting ContentVersion to ESB [closed]

We are currently designing an integration for exporting 20-50 Salesforce Files to an external system through our ESB. Our current plan is to send the record information and associated ContentVersion ...
2
votes
1answer
310 views

“Unable to create/update fields: VersionData” error when updating a ContentNote from Apex

I have some Apex code that inserts a ContentNote and the corresponding ContentDocumentLink. This works fine and the data can be viewed through the normal Salesforce UI. But some further code that ...
2
votes
1answer
437 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(...