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
1answer
24 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
28 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
28 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
15 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
36 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
21 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
11 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
38 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 ...
1
vote
0answers
17 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
23 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
64 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
48 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
25 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
32 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
96 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
76 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
31 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
21 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
36 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
116 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
184 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
58 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
209 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
262 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
102 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
189 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
66 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
37 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
394 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
53 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
18 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
405 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
118 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
161 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 ...
0
votes
0answers
27 views

How to access ContentDocument to be used as attachment in visualforce email template

How to access ContentDocument to be used as attachment in visualforce email template <messaging:attachment filename="{!relatedTo.ContentDocument.Title}" renderAs="{!relatedTo.ContentDocument....
2
votes
2answers
491 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
139 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
972 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
456 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
2k 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
487 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 ...
1
vote
0answers
130 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 ...
1
vote
1answer
323 views

System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by a single… in test class?

I'm facing System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's ...
0
votes
1answer
448 views

how can i query all attachments related to a case?

I need to be able to query for all attachments related to a single case, even the attachments related to emails on the case. I also need it this code to get all attachments if there are multiple ...
1
vote
0answers
46 views

INVALID STATUS on ContentVersion create from Attachment [duplicate]

I'm currently trying to create ContentVersion records from Attachment ones but it's giving me the following error: INVALID_STATUS, Documents in a user's private library must always be owned by that ...
1
vote
0answers
342 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; ...
0
votes
1answer
152 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
1answer
134 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 ...