Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [contentversion]

The tag has no usage guidance.

0
votes
1answer
15 views

ContentDocumentLink Throws an error using ContentVersion Object “ContentDocument ID: id value of incorrect type”

today i'm trying to upload some files to SF using Content objects. I already uploaded the ContentVersion record and the image is in SF now. The problem is when i try to upload the ContentDocumentLink ...
2
votes
2answers
29 views

ContentVersion FileExtension

Does anyone know how I can change the FileExtension for a new ContentVersion in a test class? Im currently trying to create a test class for my ContentDocumentLink Trigger, in which I have an if ...
0
votes
1answer
32 views

Preview attached pdf/doc files in lightning component

I have a requirement wherein i need to display uploaded files as preview in a lightning component. I have tried it with the below code but was unsuccessfull: Lightning Component: <aura:component ...
0
votes
0answers
24 views

Attachment's Name field changes after converting to Lightning Files

I am using the tool Magic Mover to migrate Classic Attachments to Lightning files. However, after conversion of an Attachment to a Lightning file, the Attachment's 'Name' field changes. The ...
2
votes
0answers
32 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/...
2
votes
1answer
71 views

ContentVersion's SharingPrivacy acceptable values

According to the ContentVersion documentation under SharingPrivacy, it mentions: Controls sharing privacy for a file. Only administrators and file owners with Collaborator access to the file can ...
1
vote
0answers
47 views

ContentVersion file not viewable to Guest Site User

I have Salesforce Files associated with a Contact that I'd like to pluck out the ContentVersion Id in order to display the image on a public-facing Visualforce page (via Sites): <!-- This is ...
2
votes
1answer
66 views

How to query ContentDocument and Custom object's fields at once?

We have 3 objects. OS_Account_Document__c (Custom) ContentDocument ContentDocumentLink I need to query two custom fields (Document_Type__c and Custom_Document_Description__c) from the Custom Object ...
0
votes
1answer
75 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: ...
0
votes
0answers
16 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
52 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
15 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
20 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 ...
1
vote
1answer
187 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
72 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
106 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
46 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 ...
1
vote
1answer
53 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
16 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
35 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
30 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
34 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
107 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
48 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
143 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
25 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
15 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
251 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
64 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
27 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
447 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
110 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
95 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
85 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
91 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
245 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
128 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
70 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
76 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
58 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
384 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
429 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
46 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
125 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
231 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
31 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
71 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
386 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 ...
0
votes
3answers
2k 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 ...
0
votes
0answers
35 views

How send an email with a content file which is stored in content object

I know how to send an email with an attachment, the document which is stored in attachments and document object using apex. But this seems to be more complex to me sending an email with a content ...