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.

92 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
1 answer
8k views

ContentDocumentLink Apex after insert trigger error

Edit: I've built an after insert trigger on ContentDocumentLink. On cropredy's direction, I've bulkified my code and I think improved it generally. It "works" in that it accomplishes my ...
tim shores's user avatar
5 votes
0 answers
925 views

How can you insert a Salesforce File with Collaborator ShareType?

I am currently trying to insert a Salesforce File attached to a custom Invoice object with the Collaborator (C) permission, as described on the Salesforce Documentation. The code was originally set ...
salesForceNoob's user avatar
4 votes
0 answers
1k views

USING SCOPE Everything not working

I wrote a trigger on ContentDocumentlink to get a count of number of files uploaded against Service_Request__c (Custom Object) record.It works fine for new files are uploaded on Service Request record....
sfdc's user avatar
  • 13.6k
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 ...
Alex's user avatar
  • 31
3 votes
0 answers
335 views

ContentDocumentLink SOQL doesn't return all rows

I have the same question as this one (but couldn't comment on it) To reproduce the issue: Map<Id, Contract> limitedContracts = new Map<Id, Contract>([ SELECT Id FROM Contract ...
Peter Yao's user avatar
3 votes
0 answers
302 views

How to determine if the user has enough permissions to Share ContentDocument to sObject

I have a situation that seems to be consistent with the top comments here: https://success.salesforce.com/ideaview?id=087300000006n4GAAQ Specifically, i have a Content Workspace aka Content Library, ...
zaitsman's user avatar
  • 1,890
3 votes
0 answers
398 views

SOQL query in Trigger returns no results but returns a row in Developer Console

I have the following code snippet in a Helper class that's being called by an After Insert trigger (modified to demonstrate my objective): Set<Id> reuseIds = new Set<Id>(); reuseIds.add('...
mchandler's user avatar
  • 130
3 votes
0 answers
429 views

While adding new contentDocumentLink Contentdocuments lastmodifieddate is getting changed. How we can stop that

I am migrating attachment records to contentVersion. I am also updating created and lastmodified date of new contentversion records from Attachment record. It is getting updated fine. But when I am ...
Manjot Singh's user avatar
  • 3,406
3 votes
0 answers
3k views

ContentDocumentLink - Can't set Visibility:InternalUsers when linking to case in specific sandbox

I have to push about 40,000 files into Salesforce as case files for a go live cutover. I have a process which creates a ContentVersion and then a ContentDocumentLink. In one sandbox, the files are ...
The Evil Greebo's user avatar
2 votes
0 answers
495 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
  • 125
2 votes
0 answers
221 views

File not showing preview when created by Force.com Site Guest User (i think after Summer '20 Release)

I saw that since Summer 20 changes to the rights of the Force.com Site have taken place (https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_networks_guest_user.htm) Currently I ...
arnaud's user avatar
  • 104
2 votes
0 answers
801 views

SOQL Query Returning Zero Rows on ContentDocumentLink (filtering on LinkedEntityId)

For my specific use case, I need to find all Content Documents on specific object records that meet a business requirement. However, when I filter by linkedEntityId on the contentDocument my soql ...
Davis Handler's user avatar
2 votes
1 answer
862 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 ...
Ankit Semwal's user avatar
2 votes
0 answers
132 views

Email sent when inserting ContentDocumentLink record

I have noticed that when using Apex to programmatically insert a list of ContentDocumentLink records that the users specified in the LinkedEntityId are receiving an email notifying them that the ...
Sean Russell's user avatar
2 votes
0 answers
1k views

Site Guest Users Cannot Insert or Query ContentDocument or ContentDocumentLink objects

Update (31/01/20) As per the newly created Knowledge Article, Salesforce has stated that in order to not receive an error while Inserting/Querying a ContentNote/ContentDocument/ContentDocumentLink as ...
TSmith's user avatar
  • 4,932
2 votes
0 answers
558 views

Cannot Query ContentDocumentLink as a Portal user

I have a situation where I am trying to retrieve documents which were generated by DrawLoop and added to SFDC as Files. As the System Admin user, I can query for this data using the following query: ...
Scott Cromie's user avatar
2 votes
2 answers
245 views

how to select a ContentDocumentLink via SOAP API from .NET?

We are having trouble getting a "ContentDocumentLink" object back to a .net client via an authenticated API call. A similar call works fine for records from the "Attachment" object. The credentials ...
SeanW's user avatar
  • 672
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 ...
user121495's user avatar
1 vote
0 answers
346 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 vote
1 answer
924 views

ContentVersion/ Content document link share files with partner users

I have a requirements that I need to share files with particular user which belongs to partner community user through trigger/apex code. I am using the below hard to test. But finding some issue. ...
SFDC 44's user avatar
  • 664
1 vote
0 answers
681 views

Give Delete Access on Attached files on case To Other Specified users

Whenever a Content Document is Uploaded on a record, I need to Share the file to a group of users and give delete Access to the same users. I've Implemented a trigger to share the Document With the ...
Haribhanuprasad Nandarapu's user avatar
1 vote
2 answers
3k views

How to export all the ContentDocumentLink records in Salesforce?

I am doing analysis to get the number of files attached to the each object inside Salesforce. I found that there is a standard object named ContentDocumentLink which has the reference of the each file(...
Anandhakumar Thangasamy's user avatar
1 vote
1 answer
197 views

Connect REST api to add existing file to existing folder -- like ContentDocumentLink

I'm (successfully) uploading a file to the /connect/communities/{community}/files/users/me endpoint. I'm able to share that file with a specified user by creating a file share /connect/communities/{...
Martin Cron's user avatar
1 vote
0 answers
373 views

ContentDocumentLink Limitations when querying using LinkEntityId as filter

my apologies if this has been asked somewhere else. I didn't find any answer hence I have to post this question. USE CASE: I am using database.query(queryString); In queryString = 'SELECT id,...
Anvesh Singh's user avatar
1 vote
1 answer
320 views

CreatedById Doesnt Work

I am currently developing an external application that uses the Salesforce REST API to consume. The POST method to the endpoints /services/data/v47.0/sobjects/ContentNote&& /services/data/...
CodyB1150's user avatar
1 vote
1 answer
1k views

How to upload multiple files to ContentDocumentLink Object in one call from a lightning component?

I want to upload multiple files from a public site to salesforce ContentDocumentLink. How I can create bulk of files on javascript (client) side and handle them from apex? Lightning Component: ...
Alex Andreadis's user avatar
1 vote
0 answers
471 views

How to bulk query ContentDocumentLink for Scheduled Job

I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and ...
David Leckenby's user avatar
1 vote
0 answers
774 views

Not able to create ContentDocumentLink FIELD_INTEGRITY_EXCEPTION

Trying to create a Content Document Link linking a text file to a custom object (an error log object). But keep getting the following error: First error: Insert failed. First exception on row 0; ...
Shuaib Ahmed's user avatar
1 vote
1 answer
435 views

Not able to access ContentDocumentLink on Site VF page's Controller(without sharing)

SOQL: [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = {{reocrdID}}] OR SELECT Id, (SELECT ContentDocumentId FROM ContentDocumentLinks) FROM {{sObjectAPIName}} Where id = {{...
sfdcnoob's user avatar
  • 101
1 vote
0 answers
159 views

Can't share Content Document with Salesforce object

I have a Salesforce org with Salesforce CRM Content enabled but I can't share Content Document with Salesforce object. There are no Related Content related list in layout and I also can't create the ...
Mike Raven's user avatar
  • 2,133
1 vote
1 answer
489 views

Content objects not returned in queries run by public guest/site user

When associating a Salesforce File to an object in the UI, the associated ContentDocumentLink and ContentVersion records are not returned when a public guest/site user queries for them. An internal ...
Will Johnston's user avatar
1 vote
0 answers
208 views

Translate IsPrivate check into Enhanced Notes

I am migrating notes into Enhanced Notes, How do I move the IsPrivate(Checkbox on Notes) values into Enhanced Notes? If the IsPrivate Checkbox is checked on Notes, how can I do this on EnhancedNotes?
manjula's user avatar
  • 11
1 vote
0 answers
1k views

ContentVersion trigger event AfterInsert -> Insert ContentDocumentLink -> FIELD_INTEGRITY_EXCEPTION

We need to get a solution / workaround to insert in ContentDocumentLink several links when a File that has just been inserted (ContentVersion) and sibling records of other Custom Object. A third ...
Blanca PJ's user avatar
1 vote
0 answers
422 views

How to show error msg in ContentNote?

I want to show error msg whenever notes get created without attaching to any records. As trigger on ContentNote is not available I've written Trigger on ContentDocumentLink, but I am not able to show ...
Keval Suchak's user avatar
1 vote
0 answers
697 views

Internal Salesforce.com Error while executing batch class

I want to create a batch class for the ContentdDocumentLink. I am getting records in the querylocator. But the execute() method is not working. In the debug logs also I am not able to trace any ...
Kumar Saurav's user avatar
1 vote
2 answers
1k views

Retrieve ParentID on insert of file

How to retrieve AccountId on insert of file. system.debug('LinkedEntityId $$$$'+LinkedEntityId) always gives OwnerId. But after insert of file, I can retrieve two rows from below query on ...
sfdc's user avatar
  • 13.6k
0 votes
0 answers
36 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
  • 524
0 votes
0 answers
28 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
31 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
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 ...
Satyendra Raghuvanshi's user avatar
0 votes
2 answers
227 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
0 votes
0 answers
72 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
0 answers
23 views

List only accounts with documents attached

I have the following query to get the list of accounts with documents attached to them. I need to filter by opportunity StageName: select id, (Select Id, StageName From Opportunities),(Select ...
user1282441's user avatar
0 votes
0 answers
129 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 ...
Dhiren Raut's user avatar
0 votes
1 answer
468 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
0 answers
168 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 ...
Cody Barnes's user avatar
0 votes
0 answers
83 views

Not able to call apex method from LWC in lightning flows

I am trying to call an apex class which returns a list of a wrapper class consisting of contentVersionID, filename, documentID, custom URL, and document_Type__c. I introduced the LWC component in the ...
ADITYA VAIBHAV's user avatar
0 votes
0 answers
71 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
0 votes
1 answer
90 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
0 votes
0 answers
549 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
  • 277