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.
205
questions
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 ...
1
vote
1
answer
174
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 (...
1
vote
1
answer
43
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
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(...
0
votes
1
answer
36
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 ...
0
votes
2
answers
2k
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
2
answers
76
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 ...
0
votes
1
answer
914
views
Attach Files to a Big Object record
I would like to associate Files with Big Object records.
Documentation inference implies this is not technically possible... if a Big Object could be a "LinkedEntityId" I imagine it would have been ...
12
votes
1
answer
2k
views
How to distinguish between ContentDocument and ContentNote?
There seems to be some unusual stuff going on with SObjectType for the enhanced note ContentNote (ERD) object and the underling ContentDocument (ERD) structure.
For example, both these return a ...
-1
votes
1
answer
44
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
42
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 ...
3
votes
3
answers
6k
views
Unable to delete ContentDocumentLink
This is all on a Salesforce Community.
I have a situation where a user is uploading a file and it's temporarily assigned to their user record. Once they submit the form and it creates a custom object ...
2
votes
2
answers
3k
views
Move a ContentDocument from one library to another in Apex
Is there a direct way to do this in Apex?
I tried doing DML to ContentDocumentLink or ContentWorkspaceDoc. But nothing works.
What I tried so far
Update the Library in ContentWorkspaceDoc
...
0
votes
1
answer
761
views
Attachment downloaded as type file
I have below code to add content document versionData into standard attachment.
Map<Id, Blob> bodyContent = new Map<Id, Blob>();
List<ContentVersion> contentDocs = [SELECT ...
0
votes
0
answers
44
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 ...
3
votes
1
answer
1k
views
Create new ContentVersion with ContentDocumentLink to non-user only
Every time I create a new ContentVersion without ContentDocumentId it automatically creates a ContentDocumentLink that is linked to the user. I just want it to link to an Opportunity so I'm not sure ...
-1
votes
1
answer
37
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)?
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:
...
2
votes
1
answer
854
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 ...
7
votes
4
answers
4k
views
Why SingleEmailMessage.setFileAttachments() does not create visible attachments in the Activity Tab in Lightning Experience
I'm sending emails like this:
Messaging.SingleEmailMessage m = new Messaging.SingleEmailMessage();
m.setToAddresses( new String[]{'[email protected]'} );
m.setSubject( 'test' );
m.setHtmlBody( ...
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 ...
0
votes
1
answer
57
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 ...
1
vote
1
answer
916
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
2
answers
2k
views
Error while inserting contentdocumentlink with Collaborator access through Apex
I have a lightning component which executes an apex class on load. In apex class, I'm getting some list of files and providing 'Collaborator' access to the logged-in user if he is eligible. When I'm ...
0
votes
2
answers
219
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 ...
10
votes
1
answer
7k
views
How to create an EmailMessage record with DML having HasAttachment to be 'true'?
I'm creating EmailMessage records via DML
EmailMessage createWhatEmail = new EmailMessage(
Subject = 'test'
,Status = '3'
,ToAddress = 'heim@...
0
votes
1
answer
660
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 ...
4
votes
1
answer
120
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
68
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 ...
0
votes
2
answers
224
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
127
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
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 ...
0
votes
1
answer
515
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 ...
3
votes
1
answer
4k
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
1
answer
515
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
66
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
, ...
7
votes
1
answer
4k
views
Entity 'ContentDocumentLink' is not supported for semi join inner selects
Why doesn't Salesforce support semi join selects on the ContentDocumentLink entity?
Why would there be a random entity that doesn't work like all the others?
This code:
List<ContentVersion> ...
1
vote
2
answers
2k
views
How to upload file inside a folder inside a Library through apex?
Suppose I have a library named xyz and a folder inside it named abc. I am able to insert a file into the library through the apex via the Content Document link. But how to move the file to a folder ...
0
votes
1
answer
459
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 ...
1
vote
1
answer
498
views
Syncing Files between orgs (e.g. via Salesforce Connect's Cross-Org Adapter?)
Can anyone suggest a high-level solution for the use case of syncing Files between orgs (one-way is fine)? Preferably something that can be quickly POC'd.
For us, Plan A would be to use the ...
0
votes
1
answer
221
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 ...
0
votes
0
answers
163
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 ...
0
votes
2
answers
56
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
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
0
answers
81
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 ...
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 = [
...
2
votes
1
answer
129
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
56
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
1
answer
471
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 ...
0
votes
1
answer
4k
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"...