Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

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
78 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
33 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
42 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
79 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
127 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
116 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
158 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
  • 777
1 vote
1 answer
54 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
  • 777
0 votes
0 answers
44 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
  • 616
0 votes
0 answers
52 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
56 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
421 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
71 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
415 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,884
0 votes
2 answers
89 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
103 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
74 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
75 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
84 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
161 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
451 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
244 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
  • 36.6k
0 votes
0 answers
170 views

i am trying to upload and store files in multiple collections in Screen Flow but its not assigning ContentdocumentLink in Assignment

I am working on Screen Flow. and i want to upload multiple files and also to store multiple file in related Record Id. as i am doing with content document link i need to assign and add single content ...
Tushar Kumar's user avatar
0 votes
2 answers
551 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
950 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
1k 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
87 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
811 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
87 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
99 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
174 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
61 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
  • 347
0 votes
1 answer
615 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
112 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
337 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
4k 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
2 votes
0 answers
616 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
  • 135
0 votes
0 answers
747 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
534 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
  • 135
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
  • 147
0 votes
1 answer
918 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,857
1 vote
0 answers
432 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
0 votes
1 answer
288 views

ContentDistributionTrigger after insert ContentDownloadUrl null

I have a ContentDistributionTrigger trigger after insert & update which when fired has a null value for ContentDownloadUrl. The ContentDistribution is created in a ContentDocumentLinkTrigger as ...
Jurgen Palsma's user avatar
0 votes
1 answer
1k views

Is it possible to have folders under the Opportunity / Notes & Files tab?

I tried to find out if it's possible to create folders where files can be stored, but all I can find is having the "File" tab separate and accessing the folders there through Libraries. Once ...
Anna Spasova's user avatar
0 votes
1 answer
754 views

Sorting ContentVersion based on Related objects like Account, Contact

I want to build a photo gallery where I can sort Images based on accounts, contacts or any other object. But not able to do so due to Data model of ContentVersion/documents. I can't sort ...
Manjot Singh's user avatar
  • 3,516
0 votes
2 answers
473 views

Update custom field on Opportunity on attached file deletion - Lightning

I have setup a trigger to update a custom checkbox Attachment__c on opportunity on uploading or deletion of file as an attachment. This seems to work fine on the file upload but fails every time on ...
Sachin Prasad's user avatar
1 vote
1 answer
636 views

SOQL Subquery - Getting Cases that have updated ContentDocumentLinks (Attachments)

I have an integration that pulls cases using the following query. This works well. SELECT id, casenumber FROM case WHERE LastModifiedDate >= 2022-02-21T22:08:01Z AND LastModifiedDate <= 2022-...
Nayrb's user avatar
  • 113
0 votes
2 answers
3k views

Trigger to check if a file is attached to a custom object record

I have a scenario where I need to check if a file has been added to a custom object record. If a file is already present, then the user should not be able to upload more files. Else, the user should ...
Roman Regmi's user avatar

1
2 3 4 5