Skip to main content

Questions tagged [contentdocumentlink]

Use this object to query the locations where a file is shared or query which files are linked to a particular location.

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

ContentDocumentLink Trigger referencing User Object for LInkedEntityID

I have a requirement to create an Email notification when an attachment is added to a custom object. I have seen other questions and resolutions here that reference the fact that LinkedEntityId cannot ...
John Gilani's user avatar
0 votes
0 answers
13 views

How do you link to the uploaded file to an Assessment Question Response of data type File?

I want to link the uploaded file for this AssessmentQuestionResponse. In the Response Value field is the ContentDocumentId I tried using the AssessmentQuestionResponseId as the LinkedEntityId to ...
ash's user avatar
  • 1
0 votes
1 answer
47 views

Need a SOQL query to retrieve files from Case object

The UI shows multiple documents associated with a Case. I am attempting to write a query to extract the documents. The query below is not pulling any results back. SELECT ContentDocumentId, ...
user79858's user avatar
0 votes
1 answer
66 views

ContentVersion is not visible but CDL is

The SharingPrivacy (File Privacy) is set as "Visible to Anyone With Record Access". I've a screen flow (running in system mode). This flow is on the Account record. It is supposed to get all ...
flowgician's user avatar
0 votes
0 answers
46 views

Can't share a file because it's managed by library , How to share a library then?

i want to create a public link for a file , Class : public void execute(Database.BatchableContext BC, List<Challenge__c> scope) { Set<Id> testIsd = new Set<Id>(); ...
Fark's user avatar
  • 27
0 votes
0 answers
48 views

How can I create a public link for a content folder via Apex that opens the folder in Salesforce Lightning Experience?

I was trying to generate public link for content folder inside one of my library via apex. I am using following code snippet from anonymous window:- String folderUrl = URL.getOrgDomainURL()....
vikalp saxena's user avatar
0 votes
0 answers
29 views

Content Note Owner loses access to edit Note after an edit by other user, wanted to retain the edit access for owner

If user A creates & owns the note and later other User B updates the same content note then after the update User A will not be able to edit the same note even though User A is the owner. [This ...
Ravi Roy's user avatar
0 votes
1 answer
126 views

Nested query doesn't work

EDIT: I am using simple-salesforce with the REST API to make requests. I'm trying to get for each Case all the EmailMessages, and for each EmailMessage, all its ContentDocumentLinks (from which I can ...
Labo's user avatar
  • 111
0 votes
0 answers
39 views

Calling a flow that creates a list of uploaded files from an apex class is always one file behind

I am using a Flow to update a File_links__c on a record with the list of all the files for that record. This flow was originally a record-triggered flow. Editing any field in the record triggers a ...
ash's user avatar
  • 1
0 votes
1 answer
53 views

Can visibility of Files related to sObject be restricted for certain users that have edit access to that object

We have Internal Financial Request object and Files related list. Let's assume there is two users user1 and user2 with edit access to a particular record of IFR. If user1 uploads file related to this ...
dobra_wodka's user avatar
0 votes
0 answers
105 views

Cannot render pdf file in contentdocument in PDFjs viewer using salesforce URLs

I am creating a simple PDF viewer using PDFjs library (pdfjs-4.0.379-dist), where I have viewer.html and js in static resources, and pdf.mjs and pdf.worker.mjs library from CDN in viewer. Using CDN ...
Bibek Chaudhary's user avatar
0 votes
0 answers
232 views

SOQL nested query ContentVersion, ContentDocument, ContentDocumentLink

I am trying to access ContentVersion, ContentDocument, ContentDocumentLink to achieve a count of each contentversion per object. The relationships between the objects I activated QueryAll Document, ...
Art's user avatar
  • 11
0 votes
1 answer
431 views

See what objects ContentDocument is linked to and get the count per objects

To keep it simple, I want to know to which Objects are linked my Attachments, so I executed the following SOQL query : select count(id), Parent.type counter from Attachment group by Parent.type I ...
Art's user avatar
  • 11
1 vote
1 answer
275 views

Uploading a Content Version record using Postman with OwnerId field throws error

I have created a connected app which my client will be using to create cases in Salesforce. On testing the connected app using Postman I was able to get the access token, and also responses for SOQL ...
sumchans's user avatar
  • 821
1 vote
1 answer
86 views

Error id value of incorrect type when inserting ContentDocumentLink

I know from the error that it is looking for the id of the contentdocument and not the id of the contentversion that got inserted. But I am just confused after inserting the files how do I get the id ...
sumchans's user avatar
  • 821
0 votes
0 answers
45 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 ...
Raphael D's user avatar
  • 626
0 votes
0 answers
81 views

Why can I create a ContentDocumentLink via Apex but not via DataLoader?

I am trying to copy data from one org to a sandbox via a backup tool and SF Data loader. Most things worked fine, but ContentDocumentLinks are missing. I tried loading them via Salesforce Data Loader, ...
Andreas Tschritter's user avatar
0 votes
1 answer
61 views

ContentDocumentLink Trigger successfully blocks file upload on Org but fails in Dev Console

I want to block file uploads (ContentDocumentLink) on a FundingOpportunity object when status is Canceled or Closed. It works fine in the org, but it fails when I tried it on Dev console. A File is ...
ash's user avatar
  • 1
2 votes
1 answer
825 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 ...
Maciej's user avatar
  • 45
0 votes
1 answer
166 views

Inserting List of ContentVersions and ContentDocumentLinks at the same time

I'm looping through a list of records, creating content versions, adding to a list of content versions and then inserting the list of content versions. I then need to create a content document link to ...
Joe Hayes's user avatar
  • 372
1 vote
1 answer
591 views

Attempting to pass Flow variable to Apex to use in HTTP request & create PDF

I think I'm quite over my head in this class. I'm trying to do about three different things that are brand new to me. In short, I'm trying to do this : Pass a variable to an Apex class from a Flow (...
Zoom_v's user avatar
  • 3,904
0 votes
2 answers
93 views

Updating Account Object in Salesforce with Apex Trigger

I'm new to apex and trying to figure out how I can update a custom field on the Account object when a note is added. This is what I have for a trigger but the field isn't updating. I am not getting ...
David's user avatar
  • 1
-1 votes
1 answer
157 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 ...
Jakka rohith's user avatar
3 votes
0 answers
99 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 ...
Alex's user avatar
  • 31
0 votes
0 answers
114 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 ...
Satyendra Raghuvanshi's user avatar
-1 votes
1 answer
128 views

How to make an attached document to record visible only for the owner

How to make an attached document to record visible only for the owner of record (custom object) and not visible for other users (for wish record is visible)?
Pedro Van's user avatar
0 votes
1 answer
256 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 ...
AvailableName's user avatar
0 votes
2 answers
553 views

How to write a Scheduled Flow to count how many Notes are related to an Account record?

I'm trying to write a Scheduled Flow to count how many Notes are related to an Account record. I have a Scheduled Flow on Account that is configured to walk through all Accounts every day. The first ...
Jack Odell's user avatar
4 votes
1 answer
407 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 "...
Phil W's user avatar
  • 37.6k
0 votes
2 answers
827 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 ...
riseAJdev's user avatar
0 votes
1 answer
1k views

Is there a createdDate field on ContentDocumentLink?

I try to query the newest ContentDocumentLink on a record. My approach is pretty simple. I want ORDER BY CreatedDate and LIMIT 1. ContentDocumentLink cdl = [SELECT Id FROM ContentDocumentLink WHERE ...
Gerke's user avatar
  • 155
1 vote
1 answer
2k 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 ...
Mike Cuming's user avatar
0 votes
1 answer
122 views

Account Documents

I am using the following SOQL query to get the documents attached to an account: select LinkedEntityId , ContentDocument.Title , ContentDocument.ContentSize ,ContentDocument.Description , ...
user1282441's user avatar
0 votes
1 answer
1k 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 ...
Victoria Aroworade's user avatar
0 votes
2 answers
118 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 ...
Austin Kelly's user avatar
0 votes
0 answers
107 views

ContentDocumentLinks subquery stopped working

I previously had this code and it was working (ContentDocumentLinks as related list subquery): List<Id> recordIds = new List<Id>{'0032200000SRusR'}; List<Contact> contacts = [ ...
Mariia Illarionova's user avatar
2 votes
1 answer
201 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 ...
Dan Hardy's user avatar
0 votes
1 answer
66 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>(); ...
Phuc's user avatar
  • 373
0 votes
1 answer
752 views

Can't add 1 file to object

I have the requirement to create a validation rule that only allow you to set the status in closed won if a file is attached to the opportunity. To achieve this, I have created a custom field which is ...
Jav's user avatar
  • 13
0 votes
1 answer
125 views

Post request with polymorphic field on the body

I am trying to send a post request to ContentVersion to migrate my contentVersions from point A to B : i build the body like this : body = ('{"Title" :"'+Title+'", &...
Amir Bouzid's user avatar
1 vote
0 answers
365 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 ...
user121495's user avatar
1 vote
1 answer
5k 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. ...
Simple Code's user avatar
3 votes
0 answers
691 views

Visibility InternalUsers is not permitted for this linked record only in Test context

I am receiving the following message when trying to insert a ContentDocumentLink in a trigger but only in test context : Visibility InternalUsers is not permitted for this linked record I checked ...
THEDJA's user avatar
  • 155
0 votes
0 answers
799 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, ...
Lut's user avatar
  • 287
2 votes
1 answer
610 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 ...
Jeff's user avatar
  • 145
0 votes
2 answers
2k 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, ...
THEDJA's user avatar
  • 155
0 votes
1 answer
2k 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 ...
bart2puck's user avatar
  • 145
0 votes
1 answer
1k 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....
Yauheni's user avatar
  • 29
1 vote
2 answers
4k 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 ...
Anu's user avatar
  • 3,879
1 vote
0 answers
468 views

Prevent creating new file while uploading new file from Salesforce standard upload button

Whenever a user uploads a new file under a particular record, I need to check for an existing file with the same name. If there is an existing file, then it should not create a new document; instead ...
Ajith Kumar's user avatar

1
2 3 4 5