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
19 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,...
0
votes
0answers
22 views

How to get all sharing details of a File

I am using below SOQl to get sharing details of a particular file, With below query I am able to get sharing details if file is shared to a particular User, Group and Organization but Its not giving ...
4
votes
1answer
175 views

How to download files, documents (attachments) in salesforce via apex?

I want to download all files associated with records (single or multiple records) of a particular object at one click, using apex. Let's say that there is a custom object myVehicle which holds ...
0
votes
2answers
86 views

Prevent files from being duplicated ContentVersion - ContentDocumentLink

I have button, when click on it, it'll generate a doc and stock it in Files I want to > when i click on that button again, the doc will not be duplicated Code ContentVersion contVer = new ...
0
votes
1answer
116 views

Inserting contentdocumentlink in contentdocumentlink trigger throws errorDocument with ID: xxx is already linked with the entity with ID: xxx:

the requirement is when an file is added not uploaded to event that is associated with some opportunity, i want that file gets associated with opportunity as well And when we add a file "it somehow ...
0
votes
0answers
13 views

Performance of content-based Files/Notes versus the older Attachments/Notes?

We have a Visualforce that supports large numbers of Notes and Attachments (100+) that we have converted to use Content Objects via ContentDocumentLink. But the queries now run much slower. Are there ...
0
votes
1answer
20 views

How to subscribe to a ContentDocument using API?

I am trying to develop a Custom UI for subscribing ContentDocument and found out that we have ContentSubscriptionObject which stores subscription information of the document. However we cannot insert ...
0
votes
0answers
29 views

Transfer Notes and Attachments from One Object to Another

need help figuring our my batch job that moves Notes and Attachments from one object(dsfs__DocuSign_Status__c), to its related Account, then delete the notes and attachments after they are moved. I ...
1
vote
1answer
44 views

How to disable Salesforce file share email

When the below code runs: ContentVersion doc = new Contentversion(); doc.title = fileId + '.pdf'; doc.versiondata = contentData; doc.PathOnClient = '/filename.pdf'; doc.FirstPublishLocationId = ...
0
votes
2answers
36 views

How can I mark a contentDocument or ContentDocumentLink?

I made a lightning web component to set if a content document it is approve or reject but I cant create any field in this objects... There is a way to mark if a Content document was approve or reject ...
1
vote
0answers
22 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/...
2
votes
0answers
30 views

SOQL Querry Error for ContentDocumentLink [duplicate]

Error: Implementation restriction: Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple ...
0
votes
0answers
20 views

Sharing files externaly not working as expected

As severe topics advise, I am using contentdistribution to generate DistributionPublicUrl to share Files as images externaly. The problem is that the url generated have like a bar with the name of ...
0
votes
1answer
69 views

Issue with Displaying Images using ContentDocumentLink

I am having trouble displaying images using Content Document Link in my aura component. I had used these links for reference: https://developer.salesforce.com/blogs/engineering/2014/04/building-...
0
votes
0answers
27 views

How to delete ContentDocument records which is associated with its Parent record , based on Parent Field value?

Parent Object: ccrz__E_OrderShipment__c Field: Status: Cancelled / completed /Process Currently we are deleting the attachment (Doc) which is 180 days old. Now we need to add one more condition that ...
0
votes
0answers
22 views

Prevent Duplicate files - ContentVersion

I have button which is linked to VisualForce page I don't want the files to be duplicated once i click on that button , Can anyone help me on that please? if(!test.isRunningTest()) body = pdf....
2
votes
1answer
52 views

Why Blob equals doesn't work if one of the Blobs is retrieved from ContentDocument?

In brief, I can't test the value stored in a ContentDocument. Even if the value of the two Blobs is the exact same, equals would return false. Do someone know the reason? Here's a unit test to check ...
2
votes
0answers
26 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 ...
2
votes
0answers
24 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, ...
3
votes
0answers
86 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('...
1
vote
1answer
49 views

Find all notes which are not related to anything

We imported numerous notes into Salesforce and we were able to connect most of them to their corresponding objects with ContentDocumentLink. However, a few of need to be manually connected. So how can ...
2
votes
1answer
33 views

Perplexing ContentDocumentLink SOQL issue

I have the following code: // Note: cdlToDos == Map<Id, Set<decimal>> System.debug(cdlToDos); List<ContentDocumentLink> cdlList = [ SELECT Id, ContentDocumentId, LinkedEntityId ...
-1
votes
1answer
26 views

How to delete uploaded files from community attachements

I am uploading pdf into the attachement from community. So after uploading the pdf. Pdf will create a case into the salesforce org. So i want that after creating the case in custom object called audit ...
2
votes
0answers
48 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 ...
3
votes
1answer
300 views

Why can't I Insert ContentDocumentLink linking to Community user?

I have written a trigger class on content document link to create a task whenever a community user creates a task on a case. Currently, the trigger works perfectly when attaching a case through the UI,...
2
votes
0answers
150 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 ...
0
votes
0answers
36 views

ContentDocumentLink trigger context variable trigger.new is not returning correct value in Classic

I am having a trigger on ContentDocumentLink object. The user upload a file from UI in classic on Opportunity object record. Ideally when he does that, The trigger.new should return two value, one ...
0
votes
0answers
25 views

Added ContentDocumentLink to Library but Library Members Can't See Record

So I have a ContentVersion that gets added to a record, then I create a ContentDocumentLink record connecting that File to the Library. That Library includes community users. How come they can't see ...
0
votes
1answer
55 views

ContentVersion to be accessible by ALLUsers so community users can see

Currently, adding in ContentVersion records which hold Files. I want them accessible by Community users but the associated ContentDocumentLink is defaulted to view for InternalUsers. Is there a way to ...
0
votes
0answers
302 views

Visualforce page rendered as PDF saving to salesforce files (Content document) but failed to reload error on opening pdf

Rendering VF page as PDF. Attachment pdf is working fine in classic. On opening pdf in classic view PDF is correctly opening but when i switch to lightning then on click of button pdf is saved in ...
1
vote
1answer
397 views

ContentDocumentLink fires trigger multiple times on list insertion [duplicate]

We have a trigger on Order attachment insertion, so that a field is populated with a link to the attached documents whenever a user uploads one or multiple files to an existing Order. We created the ...
0
votes
1answer
93 views

How to add a filter in query to only fetch specific files

I am running a SOQL query on contentversion to fetch files that are attached to opportunity. However, I am noticing that it is even pulling the notes attached to the opportunity as well. Is there a ...
0
votes
2answers
346 views

How to copy LinkedEntityId/Opportuntiy id in Content version object via Apex trigger

I have created a custom field(lookup field to opportunity) on Content version object that would denote the opportunity id that file is connected to. The custom field is Opportunity__c. Here is the ...
0
votes
1answer
439 views

How do I display Opportunity ID/LinkedEntityID in content version object

I am running a query on contentversion to fetch files related to opportunity from Salesforce. However the content version records returned from the query does not tell me what opportunity id is that ...
0
votes
1answer
188 views

How to create a nested query that fetches opportunities, Content Document and Content Version [duplicate]

I am trying to fetch all files that are associated with the opportunities in 'XYZ' stage. I am trying to construct one nested query that would first fetch all the opportunities in that stage, then ...
0
votes
2answers
345 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
0answers
88 views

Test class coverage issue for calling email template and inserting email message

I have written test class for the below Apex Trigger but still cannot get the coverage for calling email template and inserting outgoing email message.How can i test them using apex. Apex Trigger ...
0
votes
1answer
41 views

Linking ContentDocuments to Products

I am looking to associate ContentDocuments to Product2 records based on values in the ContentVersion record. For example I am uploading a new File record in Salesforce that is a document about ...
2
votes
2answers
722 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 ...
0
votes
0answers
68 views

Error while inserting a new revision of a file programatically

I am trying to upload a new revision of a file in ContentVersion object programmatically by Apex. I am getting the below error while inserting a new record of ContentVersion. 15:21:52:424 ...
0
votes
1answer
21 views

Documents in Salesforce Customer portal behind login

We have a Customer portal that our member log into. Once they log in they have access to a documents library which are are held in the Static Resources section. I have a document that we will want ...
1
vote
1answer
702 views

Deleting 'Files' in Lightning Experience

As per Salesforce documentation 'Files' (ContentDocument) can be deleted only by the user who created them. In order to provide access to delete a file created by other users, Salesforce recommends ...
0
votes
1answer
166 views

How to create a new contentversion(pdf) using the existing contentversion(word) version data

I want to generate the pdf file using word document. I was trying to create the new contentversion(pdf) using the existing contentversion(word) versiondata. However, the pdf is not opening after ...
0
votes
0answers
182 views

SF Integration unable to add attachment from Docusign

Hi guys i just wanna ask what is this error from Docusign. I've tried to use Salesforce connect for our app in order to save the completed document in notes and attachment. But everytime I complete a ...
2
votes
2answers
766 views

ContentVersion FileExtension

Does anyone know how I can change the FileExtension for a new ContentVersion in a test class? Im currently trying to create a test class for my ContentDocumentLink Trigger, in which I have an if ...
0
votes
1answer
207 views

How to generate an external downloadlink for files

I have created a visualforce page (site) with a dowloadlink from files. I can use this when I am logged in into Salesforce. I want to achieve this for external users by a site. In salesforce It is ...
2
votes
1answer
1k views

How to query ContentDocument and Custom object's fields at once?

We have 3 objects. OS_Account_Document__c (Custom) ContentDocument ContentDocumentLink I need to query two custom fields (Document_Type__c and Custom_Document_Description__c) from the Custom Object ...
1
vote
1answer
531 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: ...
5
votes
3answers
3k views

How to generate a download URL for a ContentDocument in Lightning Community

We're querying ContentDocumentLink for a list of documents related to a specific object record that the user has access to, and attempting to create a link for the community user to download that ...
2
votes
1answer
689 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 ...