Questions tagged [contentversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

Python: ContentVersion.VersionData throwing Incorrect padding while decoding to base64 string

I have the following Python code using Simple_Salesforce module: def get_email_template(sf, agreement_id): email_templates = sf.query(f""" SELECT VersionData, Title, PathOnClient ...
0
votes
1answer
20 views

Permissions for Flow Users on ContentDocuments

I have a signature capture screen flow that allows us to get digital signatures for users. When testing as a system admin everything worked as expected but when running as a user they don't appear to ...
1
vote
1answer
25 views

How to disable Salesforce file share email

When the below code runs: ContentVersion doc = new Contentversion(); doc.title = fileId + '.pdf'; doc.versiondata = contentData; doc.PathOnClient = '/filename.pdf'; doc.FirstPublishLocationId = ...
6
votes
0answers
29 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): ...
2
votes
1answer
36 views

Test Class for ContentDocumentLink causing Internal Salesforce Error

I have a test class that is inserting a ContentDocumentLink between a ContentNote (SNOTE) and a custom object. Everytime I try the insert it causes an Internal Salesforce Error. I have absolutely ...
1
vote
1answer
30 views

JSForce retreiving VersionData problem [duplicate]

The task: We have over 1500 .msg files in Salesforce, which are Outlook containers for Mail conversations plus attachments. The idea is to build a script, which downloads all files, extract each ...
0
votes
0answers
21 views

How to delete ContentDocument records which is associated with its Parent record , based on Parent Field value?

Parent Object: ccrz__E_OrderShipment__c Field: Status: Cancelled / completed /Process Currently we are deleting the attachment (Doc) which is 180 days old. Now we need to add one more condition that ...
0
votes
1answer
15 views

Report on Notes and Files that are shared with accounts

I have a requirement where I need to get the file names or count of files that are uploaded under each account in Salesforce. I understood that the notes and attachments can be queried from content ...
0
votes
0answers
14 views

Prevent Duplicate files - ContentVersion

I have button which is linked to VisualForce page I don't want the files to be duplicated once i click on that button , Can anyone help me on that please? if(!test.isRunningTest()) body = pdf....
0
votes
0answers
28 views

How to upload image to Salesforce from a native iOS app built using Salesforce Mobile SDK?

I want to upload an image to Salesforce database from my native iOS app built using Salesforce mobile sdk. I heard we should be making use of ContentDocument, ContentVersion & ContentDocumentLink ...
2
votes
1answer
38 views

Why Blob equals doesn't work if one of the Blobs is retrieved from ContentDocument?

In brief, I can't test the value stored in a ContentDocument. Even if the value of the two Blobs is the exact same, equals would return false. Do someone know the reason? Here's a unit test to check ...
0
votes
0answers
45 views

How to use Composite Request to insert ContentVersion?

I am using the composite REST API through a java interface to create files on salesforce. The problem is when I try to open in preview or download the files, the files are corrupt or cannot be opened. ...
0
votes
1answer
18 views

Delete all attachments at a time on a Particular Opportunity Record

I have to delete all attachments related to a particular Opportunity Record based on Id or Name. Currently, I am deleting them manually one by one. Is there any workaround to delete all attachments ...
1
vote
1answer
54 views

jsforce query on ContentVersion returns the url rather than Base64 value

I am using jsforce for fetching ContentVersionData from a Node app. My query is SELECT VersionData FROM ContentVersion but instead of fetching the base64 value in VersionData field i m getting an url. ...
0
votes
1answer
32 views

Content version error 'bad value for restricted picklist'

I'm trying to write a simple trigger to change the picklist value 'SharingPrivacy' on 'Content Version' object when a new attachment is uploaded but I'm getting error 'bad value for restricted ...
0
votes
1answer
66 views

Any way to Query for LinkedEntityId from ContentVersion

Wondering if there is anyway to query for LinkedEntityId from ContentVersion? As i understand, ContentVersion looks up to ContentDocument which then looks up to ContentDocumentLink (could be wrong ...
2
votes
1answer
41 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
20 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
37 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
48 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
207 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
24 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
21 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
38 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
49 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
31 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
127 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
39 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
204 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
49 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
32 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
45 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
58 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
223 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
28 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
278 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
155 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
108 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
70 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
196 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
24 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
86 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
134 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
62 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
37 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
13 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
53 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
47 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
47 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
113 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 (...

1
2 3 4 5