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
1
vote
0answers
22 views
+50

Can Files be synced with the Salesforce Connect's Cross-Org Adapter?

Can Files (ContentDocument/Links)* be synced one-way from a provider org to a subscriber org with the Salesforce Connect's Cross-Org Adapter? I've been told "No" by the original implementer, ...
0
votes
1answer
27 views

How to view the content Document in Lightning Community

I have an option to Upload the document in the community Portal. <lightning-input type="file" onchange={handleFileChange} name="uploadFile" multiple label="Attachment"...
0
votes
1answer
25 views

Problem Querying Fields on ContentVersion When User is not the Owner

UPDATE This can reproduced in any org, so it may be designed behavior or a bug. Basically, if a user is not the owner of a ContentVersion record they will only be able to filter by Id or ...
0
votes
0answers
38 views

The field VersionData not queried in SOQL for ContentVersion sobject

I queried the ContentVersion object by following soql, VersionData field is not retrieved in results. SELECT Id, Title, VersionData, PathOnClient, ContentSize FROM ContentVersion WHERE Id=<Id> ...
0
votes
1answer
20 views

Why does this query on ContentDocumentLinks work, when the LinkedEntity doesn't have record types?

When executing this query I'd expect this query to throw an exception, since the object does not have record types. but it doesn't. Why doesn't it throw an exception SELECT Id, (SELECT Id, ...
0
votes
1answer
38 views

APEX Class invoked by flow to delete Content Documents, get DML exception on delete "ENTITY_IS_DELETED

I have made this simple class to assist a flow to delete content documents, it is working just fine in my apex tests but when I invoke it from a flow I get the following error message: 13:35:33:092 ...
0
votes
1answer
64 views

How to run the code when the parameter was passed

I am facing the problem that I cannot run the code because there are no triggers to run it. I need the pdf file to be previewed in the module window. Tried through conectedCallback and wire, it didn't ...
0
votes
0answers
47 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. ...
0
votes
0answers
15 views

Error with ContentDocumentLink insert null pointer

I am trying to create a salesforce file and link to it.But when i run the code i get an error BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object on the line ...
1
vote
0answers
29 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 ...
0
votes
0answers
27 views

File Delete Access to Certain Group of 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 ...
0
votes
1answer
47 views

How to fetch the latest file in SOQL from each Order record

I am querying files from the list of Order records through SOQL. I have added my SOQL query below for your reference. I want to query only the latest file which begins with 'IO_' from each Order ...
0
votes
1answer
20 views

Query AccountId from LinkedEntityId

I would like a list of all files which are concerning to a account record, but my files have only a relation to the contacts. How can I query all files of the account? The LinkedEntityId is from a ...
0
votes
1answer
65 views

How to access files from a particular folder in a library to send it as attachments through an email?

I am trying to find a way to query files from one of the folders in a library. I am seeing there is no strong direct relationship between library and folder it seems. My use case is, I need to query ...
0
votes
0answers
44 views

Anyone using sfdx force:data:bulk:upsert to update Files (ContentDocument/ContentVersion)?

I have some small place-keeper files (ContentDocument/ContentVersion) loaded by some existing code but want to replace the content with the actual PDF/Video data. This is to pre-load scratch orgs with ...
0
votes
0answers
42 views

Content Version's Content Size

i am unable to pass values to Content Version's ContentSize Field. i am getting this compile error: Field is not writeable: ContentVersion.ContentSize here is my sample code: trigger ...
0
votes
2answers
136 views

How to query the Content Id of a File?

After creating a public link of a File using ContentDistribution, you get the below URL https://--c.documentforce.com/sfc/dist/version/renditionDownload?rendition=ORIGINAL_Jpg&versionId=...
0
votes
1answer
40 views

Testclass for wrapper class implements Comparable and contentdocumentlink

I don't know how can I test my contentdocumentlink, in the log I got the information EXCEPTION_THROWN [18]|System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by ...
0
votes
0answers
17 views

How to convert an incoming email HTML body into a Content Document?

I have a use case where the HTML body of an incoming case email is needed as reference on several different objects. It would be easiest to just convert the email body to a Content Document, but how ...
0
votes
2answers
545 views

Attach File (ContentDocumentLink) to Email

I'm creating and sending one email via APEX. However I havent found any documentation helping me to attach a File (ContentDocumentLink), not an Attachment to an Messaging.SingleEmailMessage. The query ...
0
votes
0answers
19 views

ContentDocumentLink query not working with dynamic Id

Im trying to querry the ContentDocumentLink object and althogh I have a ContentDocumentId with a valid ID it wont populate the querry. for(ContentDocument cd: newList){ derp = cd.id; } ...
0
votes
2answers
368 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(...
0
votes
1answer
360 views

Community User cannot download or preview docx file LWC

The url for preview and download of a docx file is not working on Community. The ContentDocumentLink is connected via the LinkedEntityId field to a custom sObject called SupportingDocuments__c, which ...
0
votes
0answers
40 views

"Internal Salesforce.com Error " (FATAL ERROR) During a Batch class run on creation of opportunity products

We have created a Trigger on Content Document link Object which has a handler class which in turn calls a batch class. The process is when a user upload a csv file it will create opportunity product. ...
0
votes
0answers
19 views

Unable to query ContentDocument record after new feed gets added

Here i am unable to fetch Contectdocumentlink records. when i am hardcoding with Id it's getting records properly. Can you suggest, what is the wrong here. trigger Contenttrigger on ContentDocument (...
0
votes
0answers
48 views

Unit Testing for ContentDocument processes

Here is my testclass: ContentVersion contentversion = TestDataFactory.createContentVersion('test', 'test', 'test'); Set<Id> testSet = new Set<Id>(); testSet.add(...
1
vote
1answer
195 views

Apex Mocks test error for Domain class

We have been using FFLIB(Apex commons) in our org.I have been trying to write a test case for a Content Document Link (Salesforce Files)Domain layer But i have been getting the error : "System....
0
votes
0answers
127 views

Triggers on the Files Object

I have a trigger on the ContentDocument when all the files associated with the Parent record is deleted it should uncheck the check box field (Files_Exists__c) on Parent saying no files exists not. ...
0
votes
1answer
56 views

Why every ContentDocument have two ContentDocumentLinks?

I working with documents in salesforce and I notices that every file I uploaded have two ContentDocumentLinks. In this links one LinkedEntityId is id that I set when uploading the file, but the second ...
0
votes
0answers
32 views

Flow to create a new content note when custom opp field is populated & update same custom field when new content note is created

I have a client who has an active flow (not my dev) that is expected to perform two actions: Create new ContentNote when Opportunity.Last_Note__c is changed Update Opportunity.Last_Note__c with ...
0
votes
0answers
26 views

Querying File (ContentDocument) From Visualforce Community

I have an old Visualforce Community and in it I am using Lightning Knowledge. On my page I have a Community Login licensed user who has read permissions to the Knowledge article (Knowledge__kav). ...
0
votes
0answers
35 views

ContentDocumentLink trigger and ContentVersion FirstPublishLocationId - Too many SOQL queries

I have created a Trigger on ContentDocumentLink (before insert) that is properly bulkified. If i create 200 CDLs via API or Apex, my trigger is fine. However, if i create 200 ContentVersion entries ...
8
votes
1answer
243 views

ContentDocumentLink query returns different results based on LinkedEntityId size

If I want to find how many files are related to a given object (ex. Account), I could do the following two queries (assuming you don't hit a 50,000 row limit - this is just an example). //get accounts ...
3
votes
1answer
59 views

Incorrect result for ContentDocumentLink query

I'm trying to query all the ContentDocumentLinks related to a list of about 25000 accounts. This yields no results. However, if I limit the initial account query to only 800 accounts I do find a ...
0
votes
1answer
79 views

Rerender files related list on opportunity record page after creating content document link

I use a LWC on an opportunity record page to create a pdf document that is then converted to a base64 string. From this a ContentVersion object is created and a ContentDocumentLink from an imperative ...
0
votes
0answers
37 views

Content Document Link Error

I am getting below error: "Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using ...
0
votes
1answer
74 views

Get the owner of the file from ContentVersion? - How to Merge 2 queries

I am querying for some data on a contentversion record, and also need to get the ContentDocumentId owner. I have these 2 queries, that work. But, is there a way I can do it in a single query? Query 1 -...
0
votes
1answer
24 views

Relating multiple cases to a content note

I am basically trying to relate a note record to multiple cases. I understand that when I am trying to create a note it basically creates ContentDocument, ContentNote, and ContentVersion. I am not ...
0
votes
1answer
72 views

It is unable to get of an apex class for getting ContentDocumentLink.LinkedEntityId from the following code?

I need an apex class to get a standard object called Contentdocumentlink field called LinkedEntityId. when document upload. It should automatically create a task. I'm unable to get ...
2
votes
0answers
58 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 ...
1
vote
0answers
100 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 ...
2
votes
1answer
193 views

ContentDocumentLink trigger not running

I've been trying to track down why a ContentDocumentLink trigger is not running in a specific case. In the working cases we have code that inserts ContentDocumentLink records, but in the failing case ...
2
votes
1answer
605 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 ...
0
votes
0answers
152 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
77 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 ...
0
votes
1answer
448 views

Apex Class on ContentDocumentLink

I'll start off by saying that I am in no way a Developer, and the code I am posting is from things I have found online and recycled for my use-case. It's working, but I know it's not structured ...
0
votes
1answer
362 views

How to delete a ContentDocumentLink

I wan't to create a ContentDocumentLink and delete him in an other function, i tried this code: // function of creation: ContentDocumentLink cdl = new ContentDocumentLink( ContentDocumentId = doc....
0
votes
1answer
497 views

Retrieve the Record type name of the Related entity ID in Trigger

I am trying to get the record type name of the related/linked entity id in the trigger of the Content Document Link like below trigger setVisibilityOnNotesinCase on ContentDocumentLink (before insert) ...
2
votes
0answers
295 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 ...
1
vote
1answer
64 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/{...