Questions tagged [contentversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
22 views

In Apex, how do I know if my user can contribute content to a particular library?

Is there a way to discover if the current user can publish content to a specific Library using either Apex or Javascript? Use Case I have a shared library (DeveloperName = Shared_Forms) that many ...
0
votes
0answers
11 views

URL Link to Library Sub Folders

Goal: Provide a direct subfolder link to the user to avoid navigating the library tree folder structure to access the document. In order to get to the Library Sub Folder, I have had to do the ...
0
votes
1answer
22 views

ContentDocument Parent Object ID How to associate

I'm trying to associate some attachment documents with their Parent object, How should I do this? public static void renameFileNameForRelevePromotion(List<ContentVersion> listFiles){ ...
2
votes
1answer
29 views

Is it possible to customize the error message that appears when the user is unable to upload a file?

I'm trying to make a trigger that prevents the user from uploading a file that is larger than 100mb. I'm doing this by checking the file size in the ContentVersion trigger and using addError. However,...
0
votes
1answer
37 views

Open “Content Document Preview” via Lightning Button (Lightning Web Component)

I have a button that should display a PDF to the user when clicked. I want to replicate the behavior of the "Combined Attachments" view in the record's related list, where a click on an Attachment of ...
0
votes
0answers
21 views

Email notification on ContentVersion object

I am sending an email notification if a field is changed on Content Version object through Apex as we cannot create Workflows/processbuilder on Contentversion object. In my Apex code, I am referring ...
0
votes
0answers
14 views

Added ContentDocumentLink to Library but Library Members Can't See Record

So I have a ContentVersion that gets added to a record, then I create a ContentDocumentLink record connecting that File to the Library. That Library includes community users. How come they can't see ...
0
votes
1answer
25 views

ContentVersion to be accessible by ALLUsers so community users can see

Currently, adding in ContentVersion records which hold Files. I want them accessible by Community users but the associated ContentDocumentLink is defaulted to view for InternalUsers. Is there a way to ...
0
votes
0answers
24 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 ...
0
votes
0answers
18 views

While converting classic notes to Lightning enhanced Content Notes getting UNSAFE_HTML_CONTENT error on versionData field.!

We are migrating from Classic to Lightning, In this process we are converting classic Notes to Lightning supported Note (ContentVersion). We have a batch which does this job, getting below error: ...
0
votes
0answers
40 views

Visualforce page rendered as PDF saving to salesforce files (Content document) but failed to reload error on opening pdf

Rendering VF page as PDF. Attachment pdf is working fine in classic. On opening pdf in classic view PDF is correctly opening but when i switch to lightning then on click of button pdf is saved in ...
0
votes
2answers
25 views

Unable to access versionData from test class

I am facing an issue but I don't know what I'm doing wrong. I'm writing a test class for a code which has this 2 lines: public static Blob getPkpass(){ // more code here... List<...
1
vote
1answer
55 views

ContentDocumentLink fires trigger multiple times on list insertion [duplicate]

We have a trigger on Order attachment insertion, so that a field is populated with a link to the attached documents whenever a user uploads one or multiple files to an existing Order. We created the ...
0
votes
0answers
12 views

Multipart multi ContentVersion Upload with Python Client

i'm trying to upload multiple files (2 in this example) with multipart using a python client. this is my request import requests import base64 import json access_token = "xxxxxx" instance_url = "...
0
votes
0answers
15 views

Content Version export file names

I am attempting to export all of the attachments in our Chatter. I tried to use Data Export to export ContentDocument, ContentFolder, and ContentVersion but the files I got in the ContentVersion ...
0
votes
1answer
24 views

Trigger to populate Last Modified date on Content version?

In the content version, there is a Last Modified Date that populates both the date and time, so I created a custom field called Last_Modified__c with a field type Date that is set to create only date ...
0
votes
1answer
29 views

How to add a filter in query to only fetch specific files

I am running a SOQL query on contentversion to fetch files that are attached to opportunity. However, I am noticing that it is even pulling the notes attached to the opportunity as well. Is there a ...
0
votes
2answers
66 views

How to copy LinkedEntityId/Opportuntiy id in Content version object via Apex trigger

I have created a custom field(lookup field to opportunity) on Content version object that would denote the opportunity id that file is connected to. The custom field is Opportunity__c. Here is the ...
0
votes
0answers
15 views

Display embedded mp4 video from external Content Version

I'm trying to develop a visualforce page which displays our training videos, for this requirement, we want to upload Content Versions to one Enterprise org, make all the videos with public access (...
0
votes
1answer
86 views

How do I display Opportunity ID/LinkedEntityID in content version object

I am running a query on contentversion to fetch files related to opportunity from Salesforce. However the content version records returned from the query does not tell me what opportunity id is that ...
0
votes
1answer
57 views

How to convert Salesforce contentversion to actual file

I have created a rest API that returns the list of opportunities as well as files attached to the opportunities. I am able to call the API and retrieve the data via POSTMAN. This is the code: @...
0
votes
1answer
53 views

How to create a nested query that fetches opportunities, Content Document and Content Version [duplicate]

I am trying to fetch all files that are associated with the opportunities in 'XYZ' stage. I am trying to construct one nested query that would first fetch all the opportunities in that stage, then ...
0
votes
1answer
60 views

Fetch Files Related to opportunity in salesforce

I want to run a SOQL query that fetches files associated with opportunities(in a particular stage). If I am not wrong content version is the actual object I need to be querying on to fetch content? ...
0
votes
2answers
69 views

Error while inserting contentdocumentlink with Collaborator access through Apex

I have a lightning component which executes an apex class on load. In apex class, I'm getting some list of files and providing 'Collaborator' access to the logged-in user if he is eligible. When I'm ...
0
votes
0answers
20 views

File preview issue of ContentVersion data that is copied from Attachment Body blob

I've created my own custom Solution object for SF Lightning use. I'm trying to migrate existing SF Classic Solution's Attachment Body blob data to ContentVersion versionData blob data. Below is the ...
0
votes
1answer
35 views

unrecognized base64 character apex

I converted a pdf file in base64 with javascript. function convertToBase64() { //Read File var selectedFile = document.getElementById("inputFile").files; var cvfiles = document....
3
votes
0answers
71 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 ...
1
vote
1answer
43 views

Why am I getting a path instead of a file when I query for VersionData on ContentVersion?

When I query for VersionData from a ContentVersion record, I get "/services/data/v44.0/sobjects/ContentVersion/0681F000000QY0eQAG/VersionData" in the response. I'm expecting a base64 encoded file. ...
0
votes
1answer
31 views

Linking ContentDocuments to Products

I am looking to associate ContentDocuments to Product2 records based on values in the ContentVersion record. For example I am uploading a new File record in Salesforce that is a document about ...
0
votes
0answers
12 views

Display document based on roles

Will it be possible to display documents based on roles? Example: we have a document tied up with an Account object. There are roles that need to have read only access for Account but should not be ...
0
votes
0answers
39 views

Error while inserting a new revision of a file programatically

I am trying to upload a new revision of a file in ContentVersion object programmatically by Apex. I am getting the below error while inserting a new record of ContentVersion. 15:21:52:424 ...
0
votes
1answer
41 views

Insert of ContentVersion not bulkifying properly

I'm currently testing a trigger on ContentDocumentLinks. In order to check in a test class if it bulkifies correctly, I first try to create many contentVersions (so they can the be added to ...
0
votes
1answer
26 views

Open Excel in browser instead of Download

I have requirement where I want to display Excel in viewer instead of downloading it in Salesforce. I am using /sfc/servlet.shepherd/document/download/+ ID to download Excel. Is there any way to open ...
0
votes
1answer
59 views

Stuck writing a test class for ContentDocumentLink object apex trigger

I am trying to write a test class so that I can send the following trigger live in our production system: trigger updateDocTitleFileExt on ContentDocumentLink (after insert) { for (...
0
votes
0answers
24 views

Sharepoint Files Connect identifiers in Content Version Object

After uploading a Sharepoint file via Salesforce Files Connect, i see a record gets created in Content Version object I want to know one of the field in Content Version (ExternalDocumentInfo2) , how ...
0
votes
0answers
55 views

Has anyone solved the error 415 (Unsupported Media Type) in salesforce?

Has anyone solved the error 415 (Unsupported Media Type) in salesforce ? I tried to upload a file to ContentVersion via rest api request but it 415 error will be returned by my org. Is there any ...
1
vote
1answer
168 views

Deleting 'Files' in Lightning Experience

As per Salesforce documentation 'Files' (ContentDocument) can be deleted only by the user who created them. In order to provide access to delete a file created by other users, Salesforce recommends ...
1
vote
1answer
110 views

Field not writable: ContentVersion.FileType

In the following test method: static testMethod void testEmailWithAttachments() { ContentVersion contentVersion = new ContentVersion(); contentVersion.FileType = 'Text'; ...
0
votes
1answer
65 views

How to create a new contentversion(pdf) using the existing contentversion(word) version data

I want to generate the pdf file using word document. I was trying to create the new contentversion(pdf) using the existing contentversion(word) versiondata. However, the pdf is not opening after ...
0
votes
2answers
191 views

Query ContentDocument object to retrieve details of files

I have a SOOQL query that retreives details about files uploaded, that works great. Select id, ContentDocument.Title, ContentDocumentId, ContentDocument.LatestPublishedVersionId, ContentDocument....
0
votes
1answer
149 views

ContentVersion - Problem with base64 encoding when creating the record

I am writing a WS which gets a request base64 String & other parameters which should be used to create ContentVersion record. I tried the following from dev console. When I user base64Encode ...
1
vote
0answers
24 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 ...
0
votes
1answer
106 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
266 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
344 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
37 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
165 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
331 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
455 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
613 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 ...