Questions tagged [contentdocument]
Use this object to retrieve, query, update, and delete the latest version of a document, but not a content pack, in a library or a file in Chatter.
356
questions
0
votes
0
answers
39
views
get all stand alone FILES
I have a process of case auto deletion, and it seems that when a case is deleted and a file was attached to it, the file is not deleted in the same time.
Q1: Is it possible that files remains in SF ...
2
votes
1
answer
44
views
Create ContentDocumentLink after insert ContentDocument error
I have pretty simple requirement but I am facing error and I can't understand what is going wrong.
I need to add ContentDocumentLink to add file to CollaborationGroup after insert with C permission. I ...
-1
votes
1
answer
45
views
How to fetch file properties from Content document object using API
I am trying to get all the files attached to a case. I have found a way to download the files attached to case using
sfc/servlet.shepherd/document/download/${contentDocumentIdLink}?operationContext=S1
...
3
votes
0
answers
46
views
Mismatched LInkedEntityId on ContentDocumentLinks
I'm trying to link attachment files to Salesforce EmailMessages. Steps so far:
Upload attachment file by posting to /services/data/v58.0/sobjects/ContentVersion.
Query ContentVersion table to get ...
0
votes
0
answers
48
views
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You don't have permission to share this file.: [ContentDocumentId]
I am Facing this issue only while executing the below code in the Guest User context, how to resolve it?
The exeption occurs while inserting contentDocumentLink Record.
ContentVersion cv = new ...
-1
votes
1
answer
123
views
How to identify content documents related to a specific type of custom object
I have scenario where in I need to extract content documents related to specific object (Tried to this via SOQL like 2 step query)
SOQL for Id's of all the content documents in the org.
SOQL on ...
0
votes
1
answer
62
views
Guest User cannot edit ContentDocument
We have a system in place to allow guest users (under some circumstances) to modify files in Salesforce (those pesky ContentDocument and ContentVersion records).
This system works in the development ...
0
votes
1
answer
135
views
Proper way to store a .pdf from a REST callout using ContentVersion/ContentDocument
I am working on an integration where I am provided a URL + document ID, which should send back a .pdf, I retrieve it using a GET, and then I take the blob of the pdf and create a ContentDocument and ...
0
votes
1
answer
24
views
Does Test.setCreatedDate work on ContentDocument?
I wrote a trigger that checks if a contentdocument is greater than 10 minutes old, then throws an error to stop it from being deleted. This is to allow users to delete the file if they accidently ...
4
votes
1
answer
131
views
How can I prevent a ContentDocument being deleted when it is linked to a record meeting certain criteria?
I have ContentDocuments being used to capture "proof" against certifications. Once the submitted certification (and "proof") has been reviewed, that certification is marked "...
0
votes
0
answers
25
views
Note Test Method Issue
I created an apex method that checks if the content of a Note is lower than 10 characters. I have some problems with the test method and i can't make it work.
I get an assertion failed on this test: '...
0
votes
0
answers
77
views
Cannot insert blob file as content version
I'm trying to insert blob file as Content version into Salesforce. Im getting the response in my webhook, for which I have to make a callout to another endpoint to get the blob data. Once I got it, I'...
0
votes
2
answers
234
views
What is the order of execution in content related objects?
I have a scenario to insert the content document link for sharing the contentdocument with contentworkspace (library) when the contentdocument is created.
I want to write a trigger to achieve this.
I ...
0
votes
0
answers
34
views
Documents access to limited group of users (related to Account)
I have a requirement
There are a group of users who can upload documents on Account (possibly public group)
However, the documents uploaded should only be accessible to that group of users and not ...
0
votes
0
answers
152
views
Get content body of upload file in Flow
Hello guys I have a button in an the objet SObjectOne that calls a Flow that get the recordId of this current record and also uses the UploadFile component. After this I call an Apex class. So in this ...
0
votes
0
answers
130
views
Unable to delete ContentDocumentLink from record
This is all on a Salesforce Community.
i have made lwc component where i want to remove record from knowledge article but it is showing null pointer exception.
Firstly i am changing the owner and ...
0
votes
1
answer
63
views
Can we retrieve ContentDocuments aka Files using ANT migration tool in Salesforce? [duplicate]
I have been trying to retrieve ContentDocuments/Files
using the following package.xml in ANT
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap....
0
votes
1
answer
212
views
Is there a way to find Dimensions (Height and Width) for a Content Document
Is there a way to find Dimensions (Height and Width) for a Content Document uploaded on a custom object? The Content Document could be JPG, PNG or GIF
The use case is: When users upload a content ...
0
votes
1
answer
547
views
Another ContentDocumentLink, ContentVersion & ContentDistribution Question
I apologize if this has already been covered (It probably has, I just cant find it in the 'Open your eyes' section of the forum)
But I'm having troubles creating a list of publicly accessible URLS ...
0
votes
1
answer
480
views
Content Document Parent ID Salesforce
I am completely lost on how to populate a ParentID for Content Documents. I would like to find the parent record (custom object record) linked to the Content Document. I have easily sorted it in the ...
0
votes
0
answers
169
views
How to Append Content Document title in Salesforce
So I'm having an issue where MS teams invites are being sent to CASE queues for group meetings. This results in with a file being created which gets downloaded sometimes and sent to others.
The file ...
1
vote
0
answers
309
views
INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: [] ContentVersion
Hello I am having problems to create a ContentDocument with Apex code. I am trying to create those records from a partner user community that has some permission set. I get the next error when trying ...
0
votes
0
answers
84
views
ContentVersion - Problem is to not save the note if it has a specific sensitive data
Issue is - While creating a new note if user enters a specific sensitive data like PAN he should get an error & the user should not be able to save the note like disable the ‘Done’ button or ...
0
votes
2
answers
57
views
Query for Related Attachments works in query editor but not Apex
I am trying to make a simple APEX Class that returns a records related attachments.
When I do the following SOQL query in the Query Editor I get the 3 expected results:
SELECT Id
FROM ...
0
votes
1
answer
1k
views
SOQL Query for to fetch Content Version documents of Parent to do data update activity?
We have a requirement where when we close the work order, we have to set custom field value "Allow Archieving" to true on it's content versions documents. For this, I have already written a ...
0
votes
2
answers
1k
views
How to create a public link for library in files?
I Have a library let's say "XYZ Library" in Libraries Section of files and I need to get a public link for that library same as we create for Folders from the drop down, so that I can use it ...
0
votes
0
answers
64
views
ContentVersion Images not being retrieved in Mobile Browsers
I am storing images for LWCs as ContentVersions so that I can upload them as Files related to a Custom Object. These images show up completely fine in desktop browsers, however, I can not seem to get ...
2
votes
1
answer
134
views
Help with sorting content documents by custom field on its LinkedEntity
This SOQL statement works, but I'm trying to sort the Content Documents by a field e.g. Sort_Order__c on Invoice__c.
SELECT ContentDocument.id,LinkedEntity.Name,LinkedEntityId
FROM ContentDocumentLink ...
0
votes
1
answer
57
views
Share LinkedEntityId with grandchild
I am trying to share a file with a grandchild record.
Parent: Account:
Child of Account: Contact
Child of Contact: Invoice
if(Trigger.isInsert){
Set<Id> getAccts = new Set<Id>();
...
0
votes
0
answers
130
views
ContentVersion records created in test not returned by query in execution
I'm trying to test an apex class where I send an email. In said email, I add attachments where I have to use queries to find the contentversions and creating attachments based on those, for instance:
...
1
vote
2
answers
2k
views
Adding custom field to Files upload in salesforce
We have a custom object where we are allowing users to load files.
Now, we need to provide user a check box before uploading this files into Salesforce so that we can revisit those files for data ...
0
votes
2
answers
1k
views
Is it possible to find ContentDocument and attach that file to a FeedItem through a flow?
I am trying to create a feeditem and trying to find a documentcontent file and attaching it to this feeditem through a flow.
I think I can find the version of the contentdocument by looking at the ...
0
votes
1
answer
964
views
SOQL Query for ContentDocument
I ran this query below
select id, owner.name, ownerid, title from contentdocument where id =
'0695i000007L0FIAA0'
I got this results which shows me the owner id
I then ran another query trying to ...
2
votes
1
answer
879
views
What controls ContentVersion access in non-sharing apex class?
I recently wrote an apex class which queries the ContentVersion records for a lead and embeds them in a PDF page. The class is not running with Sharing, so system access, and everything is working in ...
1
vote
0
answers
291
views
Display folders for an object according to a picklist value using lwc
Hi all I have an object name FS where I have uploaded various files in each records.
Also in the content version record I have a picklist value named Category which has certain picklist values New and ...
1
vote
1
answer
2k
views
How to give Community Portal user access to view ContentDocument
I have a Lightning Web Component, its job is to return all the documents related to a record. I have tested the web component by running it internally and it looks like it is performing as expected. ...
0
votes
1
answer
170
views
Displaying Related Documents OF A Custom Object in VisualForce Page Salesforce
Good day everyone, I am in a little bit of a pickle and could really your use help.
So I am trying to make a visual force page that displays all the related documents to a custom object. I am ...
0
votes
0
answers
555
views
DLRS: How to count all Files (without Notes) related to an Opportunity?
I created a DLRS (Declarative Lookup Roll-up Summary) on the Opportunity that counts how many Files are related to it. However, the count gives me both the Files+Notes and I only want the File count, ...
-1
votes
1
answer
362
views
I want to write trigger to automatically upload files in bulk on Account object file related list. Please help [closed]
trigger ContentVersionTrigger on ContentVersion (after insert)
{
//SELECT ContentDocumentId FROM ContentVersion where Id=:trigger.new[0].Id;
ContentDocumentLink docLink = new ContentDocumentLink();...
0
votes
1
answer
201
views
Query files from private folders by SOQL to wipe content?
My QA users have overfloaded the Developer Sandbox with 234 MB of files.
I try to wipe all the content, however, looks like SOQL query doesn't return all the files even though I can see them in UI.
I ...
2
votes
1
answer
1k
views
LWC Content Document preview is not working
I'm having issues with opening a Content Document preview in my LWC component. Here is my code:
HTML:
<template>
<template if:true={files}>
<ul>
<template ...
2
votes
1
answer
409
views
Apex Error "Too Many SOQL Queries" with Trigger on ContentDocumentLink
I'm getting the "Too many SOQL queries: 101" when executing a test class. I'm not even getting into my test method - it's failing on the test setup. When it fails, it's failing in my trigger ...
0
votes
1
answer
61
views
Mistake is SOQL query
When I searck content document by Id I see the result, but when I search by title the result is missing. The problem appears when someone else create document. When I create documents, everything is ...
0
votes
2
answers
1k
views
INVALID_CROSS_REFERENCE_KEY : Invalid cross reference id in After insert Trigger to create ContentDocumentLink
I am encountering the following error when inserting a ContentDocumentLink record :
Error [statusCode=INVALID_CROSS_REFERENCE_KEY, code=[xmlrpc=1202, statusCode=INVALID_CROSS_REFERENCE_KEY, ...
0
votes
1
answer
1k
views
Using the API How can i get "file" attachment. I am able to get "attachment" correctly
I am able to list and download any item that the Type=Attachment with no issue.
I can get a list of items where the Type=File.
How can I Download the items that are Files? I am using Salesforce ...
0
votes
1
answer
162
views
Apex unit test - Error on ContentDocumentId(Missing field)
I'm practicing an apex unit test and getting an insert fail on ContentDocumentId and expecting a reconstruction. Any idea of this?
@isTest
public static void testUpdateResponse() {
ContentVersion ...
1
vote
0
answers
215
views
Is't Possible to update the ContentDocumentId field value of ContentVersion in Before Insert trigger? [closed]
I would like to update the ContentDocumentId of ContentVersion record in the before insert trigger.
Is this possible? If it's not possible can anyone please explain the reason for it?
Update:
When a ...
0
votes
1
answer
729
views
Can't update ContentVersion. My code create new file every time
I had such issue. I created method that save attachent to my Opportunity.
public PageReference attachInvoicePDF() {
/* Get the page definition */
PageReference pdfPage = Page....
1
vote
2
answers
3k
views
LinkedEntityId referring to custom object record id
Is it possible to map ContentDocumentLink (LinkedEntityId field) to a custom object record? As per the doc Documentation for LinkedEntityId, it has not been mentioned to be possible to reference a ...
5
votes
2
answers
700
views
Hide related list on Content Document page in experience cloud
Is there a way to hide these related lists? I finally got this url (https://HOST.cs66.force.com/PORTAL_NAME/s/contentdocument/contentDocId) which shows the content document and we can preview ...