Questions tagged [contentversion]
The contentversion tag has no usage guidance.
279
questions
2
votes
1answer
36 views
How to replicate the functionality of delivered “File Engagement” lwc card?
In our org we have a need to programmatically replicate the functionality of delivered “File Engagement” component/card.
Here is a snapshot from our live org, on a ContentDocument view page:
Since ...
0
votes
1answer
27 views
Relationship between ContentDistribution and ContentDocument build SOQL query
Is there a way to query ContentDistribution and ContentDocument ?
I'm looking to pull few fields from ContentDocument while building the ContentDistribution query.
Here is what I have done so far:
...
1
vote
1answer
42 views
ContentDistribution error = INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
EDIT:
I have enabled Salesforce CRM Content
I still see the insufficient access.
I'm trying to insert a record to ContentDistribution object using the following:
ContentDistribution cd = new ...
0
votes
0answers
11 views
How to delete files from contact object
After a field(X) is checked to true i need to delete the attached files of the related list in the contact object. How can we achieve this?
0
votes
0answers
44 views
Salesforce POST with both SObjects and ContentVersion [duplicate]
I'm trying to build functionality in Salesforce to allow a payload POST which would create multiple SObjects and ContentVersions (Images/PDFs mostly). I've built out a custom endpoint to handle the ...
1
vote
1answer
49 views
List of Salesforce objects those are File types like Document, StaticResource, Contents etc [closed]
I would like to know the list of Salesforce objects whose are based of FILE type. For example Document, Attachments, ContentVersions, Static Resources etc
I would like to see what more objects comes ...
0
votes
1answer
15 views
Is there a way to read large content version with size greater than 100 MB in chunks?
I'm planning to upload files from content version to other webservice that I don't own, the other service provide resumable API that takes only 320 KB per chunk, so Is there a way to split the blob ...
0
votes
0answers
20 views
Email Service Not Creating File - Help Please!
I have the following email service that works to create the custom object record just fine. However the file is not being created form the attachment on the incoming email. I see in the logs in the ...
0
votes
0answers
18 views
Best approach for uploading to Files to Case and CaseFeed via a Salesforce API
Hi I have the exactly same question that I found here. I just want to upload the Files to Case and link it to CaseFeed(if required). I know the post is quite old but did you find the best solution? ...
0
votes
0answers
21 views
Make ContentDocument private in bulk?
Is there a way to change the sharing setting for contentdocuments that has been shared to "Any user in your company" as viewer to be private to only be accessed by the owner via script/...
0
votes
1answer
21 views
To attach a VF page as a File in the record
I have attached a VF page in Notes/Attachments. But now i wanted it to get attached in Files.
The below code is working fine if i attach it in Notes/Attachments.
Blob pdfBlob;
PageReference ...
1
vote
0answers
31 views
How to have NetworkId (Community Id) logic working in both production and unit tests?
Some existing product code that creates ContentVersion instances is now being called from a community and the code fails with:
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the
level ...
0
votes
1answer
34 views
How can I get content version data without making self callout?
I understand that there are several approaches to get content version data.
The default and widely accepted approach is to make self-callout to REST API to get VersionData of VersionData field on ...
0
votes
0answers
31 views
Can we save contentversion record with recordtype?
@AuraEnabled
public static Id saveFiles(Id recordId, String fileName, String base64Data ) {
Id filerecordTypeId = Schema.SObjectType.ContentVersion.getRecordTypeInfosByDeveloperName()
...
0
votes
2answers
19 views
Store Notes and Attachment as a Attachment
I have Added Notes & Attachment in Related List , So when I upload any svg image , It get stored as a file instead of Attachment . So How can we store that image in Attachment instead of ...
0
votes
0answers
62 views
Save the video to files
I'm making a component that allows me to make a video with the capture of the desktop camera. In javascript I have '' vidSave.src '' which is the url of the video that was recorded. When I try to ...
0
votes
1answer
77 views
Merging Docx files into one - Apex
I have a requirement, which I should merge two or more word files (.docx) together into one file.
because I can't do arithmetic operations on Blob - I converted it to hex, made the arithmetic, ...
0
votes
1answer
21 views
Javascript runtime error on Vf page while using Blob(HTML)data as string
I have a VF page and I want to print it by using javascript code (window.print()) and the reason behind javascript - This page is getting used by other teams and I wanted to print this page only on ...
0
votes
0answers
46 views
Inserting Content Version via Community User in test class Failing
I think this is very straight forward I just can't figure out the issue behind it.
Error:
: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do ...
1
vote
1answer
112 views
Unable to insert ContentVersion record in future method in apex [duplicate]
In a partner Community, I am inserting a ContentVersion record before doing future callout and also inserting ContentVersion record within future callout .
I am able to insert ContentVersion record ...
1
vote
0answers
123 views
ContentVersion.VersionData or ContentDocument.LatestPublishedVersion.VersionData doesn't return the base64 body
We're using mobile SDK and want to retrieve the SOUP of ContentVersion bodies(VersionData) to be able to generate the images when our users are in offline mode.
According to the documentation about ...
1
vote
1answer
57 views
Display multiple PDF Content Versions in a printable view in one Visualforce Page
I'm running into an issue that I've been unable to solve surfing the web.
I am storing USPS shipping labels I am receiving from an HTTP request using ContentVersion. I would like for the user to be ...
1
vote
1answer
41 views
No such column 'ContentDownloadUrl' on entity 'ContentDistribution'
When I am trying to query ContentDownloadUrl on the entity ContentDistribution I am getting the error as
'No such column 'ContentDownloadUrl' on entity 'ContentDistribution'.
But when I am executing ...
0
votes
2answers
50 views
LWC Event/Message Listener For ContentDocument changes or new Version
I created a LWC component that displays a ContentDocument with a file preview option (using lightning navigition, NavigationMixin. I want to be able to refresh the component if the user clicks on the ...
1
vote
1answer
136 views
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY : [NetworkId]
I've written a simple trigger to enforce our Community users not to delete files. Currently, I'm facing an issue in getting test coverage for deployment.
Trigger
trigger ContentDocumentTrigger on ...
4
votes
0answers
163 views
What Does the IsMajorVersion Field on the ContentVersion Object Do?
I referred to this documentation. The description for IsMajorVersion is:
"true if the document is a major version; false if the document is a minor version. Major versions can’t be replaced.&...
0
votes
0answers
38 views
How to add a new image file into ContentVersion using Apex?
I have a URL which is a PNG file which is hosted on external cloud and I would like to create a new file with this image in my salesforce opportunity object as a file. Could anyone point me on how to ...
0
votes
1answer
25 views
Trigger on ContentDocumentLink gets fired for current user in test class
I am trying to increase test coverage of an after-trigger on ContentDocumentLink. The problem is that the trigger gets fired twice. I found out from this answer that the trigger fires one extra time ...
1
vote
0answers
25 views
ContentVersion FirstPublishLocationId, specify ShareType `I`
If i create a ContentVersion e.g. via Apex like so
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S';
conVer.PathOnClient = fileName;
conVer.Title = fileName;
conver....
0
votes
0answers
333 views
How to upload a file to an external data source (e.g. Sharepoint, Google Drive, etc) in Salesforce via Files Connect
How do you upload a file to an external data source (e.g. Sharepoint, Google Drive, etc) in Salesforce via Files Connect? Is this even possible. I've read the Salesforce articles, I've watched a ...
0
votes
0answers
62 views
Update custom field on content version trigger
I am trying to update 2 custom fields on contentversion when a new contentdistribution is created. To do this, I am using an after insert trigger on contentdistribution:
trigger ...
2
votes
2answers
223 views
Download ContentVersion Object as JPG using JSForce
I am trying to download a JPG file stored as an attachment in Salesforce, to the local machine. I have a URL that works correctly when using a GET request in Workbench. When I try to do the same in ...
1
vote
0answers
84 views
Delete a ContentDocumentLink of Library file
I have inserted a file in Library. I want to delete the ContentDocumentLink by which it is shared with the Library. I have created new ContentDocumentLink where I have shared file with a user. But ...
0
votes
1answer
41 views
When and If, Does the 'version' in ContentVersion Change?
I'm using the lightning-file-upload component to upload files (wow).
My question is: is it safe to add a custom lookup relationship on the ContentVersion object?
I guess I don't really understand the '...
1
vote
1answer
65 views
Upload ContentVersion to SF via JS
I am developing a visualforce page. I'm trying to upload pdf-file from remote server in contentversion , here is part of my code:
let response = await fetch('http://www.africau.edu/images/default/...
2
votes
1answer
73 views
Create new ContentVersion with ContentDocumentLink to non-user only
Every time I create a new ContentVersion without ContentDocumentId it automatically creates a ContentDocumentLink that is linked to the user. I just want it to link to an Opportunity so I'm not sure ...
0
votes
0answers
27 views
How to create a public Url for an attachment? [duplicate]
I used a lightning:fileUpload to insert a file into the Attachment object:
<lightning:fileUpload
recordId="{!v.patientId}"
aura:id="fuploader"
name="files&...
0
votes
1answer
247 views
REST API service URI Not working from Postman/other REST Clients,but working fine with Workbench
Am trying to Insert/Upload a File(Base64) from Rest Client by mentioning
https://mysalesforce-instance.com/services/data/v48.0/sobjects/ContentVersion
by giving Body as
{
"Title":"New ...
0
votes
1answer
254 views
Content Distribution Records are not getting created
I have a trigger which create content Distribution Records. Creating content distribution Record using following code:-
ContentDistribution cdist = new ContentDistribution(
Name = ...
0
votes
0answers
190 views
upload live camera capture photos only using lightning-file-upload
I have a requirement to upload documents from camera only and not from phone's gallery/album or something like i can check the created/lastmodified date of the file to check if it is captured at that ...
0
votes
1answer
222 views
Content Version SOQL - WIth custom field in the Where clause Return as null
I have a custom field on Content Version - but When I try to have a SOQL and receive the data its return as null.
The next line is working :
ContentVersion testContentInsert = new ContentVersion();
...
0
votes
0answers
32 views
Preview Content Version in VF page
I am building a vf page where i am trying to display the preview on the page . I am using the below code . In the code below if i hard code the content version id in the flasvars it works fine but if ...
0
votes
1answer
36 views
ContentVersion apex decoding [closed]
we are saving a docx and pdf files in contentversion. But having issue in decoding it back.
Blob.tostring doesnt work as the files encoding is not in the UTF-8 formatting.
Can you please help me ...
1
vote
2answers
348 views
upload a file in VF page to content Version is broken
I have a huge and complex vf page (force.com site) - So I will try to explain my issue with an example instead publish here all the code - I hope it will be understanble:
I want to upload a file from ...
0
votes
0answers
17 views
Creating Trigger for ContgentNote / ContentVersion etc. to capture Content Body?
I'm looking for the best approach to capture the BODY of a Content Note (Content Document) object when one is inserted or updated.
I've enabled the new lightning notes feature in some of my sobject ...
4
votes
1answer
2k views
How to download files, documents (attachments) in salesforce via apex?
I want to download all files associated with records (single or multiple records) of a particular object at one click, using apex.
Let's say that there is a custom object myVehicle which holds ...
0
votes
2answers
200 views
Prevent files from being duplicated ContentVersion - ContentDocumentLink
I have button, when click on it, it'll generate a doc and stock it in Files
I want to > when i click on that button again, the doc will not be duplicated
Code
ContentVersion contVer = new ...
1
vote
2answers
426 views
How do I get correct base64 data present in VersionData field in ContentVersion through jsforce?
I am using jsforce to query VersionData field in ContentVersion object. However, it returns me the URL to the base64 data instead of the actual data.
If I make a GET request to the URL (using the ...
1
vote
2answers
95 views
BLOB is not a valid UTF-8 string for the Contentversion of einstein_platform.pem file
In Einstein Playground app developed by the Salesforce Lab, I have uploaded the einstein platform service private key file named einstein_platform.pem to complete my einstein platform service setup. ...
1
vote
0answers
154 views
How to upload a Salesforce File using REST API properly?
GET /services/data/v47.0/sobjects/ContentVersion/0000v00000MFIVgAAP/VersionData from this request I will get binary file content, but how can I use this content to recreate the file properly (using ...