Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
2answers
31 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
36 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
71 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 ...
0
votes
1answer
76 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: ...
4
votes
2answers
70 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
68 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
43 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
72 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
59 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 ...
0
votes
0answers
24 views

Permission Error when Auto-Sharing Salesforce File with Apex Trigger

I am trying to create an Apex trigger that automatically shares an attached Salesforce File with a user related to the record upon which the File was uploaded. I believe I have created a working code ...
1
vote
0answers
16 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 ...
0
votes
0answers
27 views

Can I get a public link to an attached PDF?

We have a 3rd party that is generating PDF quotes, and attaches these to a (custom) quote object. I'd like to generate public links for these so they can be emailed to customers - but from https://...
1
vote
0answers
99 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
45 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
24 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 ...
0
votes
0answers
22 views

Trying to determine the best way to write a trigger on a file(ContentDocument) which is uploaded and Is realted via COntntDocumentLink to a Case

I am very new to Apex (I wrote one two line trigger and test class successfully) and am trying to figure out this scenario. When a customer or internal user uploads a file related to a Case I need an ...
0
votes
0answers
109 views

Add Upload File button to a custom object

I am working on an assignment where I built a custom object on top of files (ContentVersion, ContentDocumentLink, ContentDocument). Since the customizability of files is limited in Salesforce, we are ...
0
votes
1answer
96 views

ContentDocumentLink filter not working- Trailhead Conference Management App

Im facing 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 the IN ...
0
votes
1answer
148 views

Could not able to retrieve VersionData from Content Version after insert of ContentDocument

I am trying to retrieve the body of ContentDocument after insert. Below is my code.My trigger is on ContentDocument (After Insert) public static void syncContentDocument(List<ContentDocument> ...
0
votes
1answer
22 views

content deliveries and public links missing in npsp org

I have created a trigger on contentDocumentLink in my developer org and generating public url for file sharing using ContentDistribution object and when i started moving code to npsp org sandbox, ...
0
votes
1answer
32 views

Link files lead to new custom object

On Lead conversion I also create a new object to which I map several fields of the lead trough processbuilder. I also want to pass the files from the lead to the new custom object. I am trying to do a ...
0
votes
0answers
20 views

Is it possible to open a pdf/word document to a specific page or section with Lighning?

I can generate a preview of a file using e.lightning:openFiles event, but there are no parameters or options that will allow me to open the file up to a specific page or section. Is there anyway this ...
0
votes
1answer
300 views

APEX - Get ContentDocumentLink when deleting file (with ContentDocument)

I have an object 'ClientContract__c' with affiliated files. When adding a file, this changes a technical checkbox field on the parent object. I would like to override this technical field if there are ...
0
votes
0answers
47 views

ContentDocumentLink creation throwing error for guest user

We are getting following error when we try to insert contentdocumentlink to the account using guest user. Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_OR_READONLY, You ...
5
votes
1answer
59 views

Weird Behaviour of Bulk ContentDocumentLinkTrigger in Test Context

I know that ContentDocumentLink triggers are not bulkified by Salesforce. I was expecting that behavior and was writing test classes accordingly. It looks like, ContentDocumentLinkTrigger doesn't ...
1
vote
2answers
413 views

Community user cannot download file

I am using an old portal for my customers, with customer community user licenses. In the portal, my users should upload files and then download the files that they have uploaded. The portal is ...
0
votes
1answer
51 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 = {{...
1
vote
1answer
77 views

How to query contentversion to Email Message

We have integrated Salesfroce and our Support Page, and I have to send emailmessage via rest api along with attachment lies within the email, but I don't find a relateionship between Contentversion ...
4
votes
1answer
604 views

How to Upload a File to a specific Library Folder using Apex?

I am trying to save a Visualforce page as a PDF file to a Library folder in our Salesforce org. I have been unable to figure out how to save this new PDF file to a specific Library folder. I tried ...
0
votes
1answer
236 views

content version - clone from one object to another

I am trying to clone File(s) from a parent object to child. The code I am using is doing that but the file type is set to "LINK" while doing so, and I am unable to open that file or it has nothing ...
0
votes
2answers
403 views

Cannot update contentDocumentId in contentDocumentLink

I am sharing a file with a task by creating ContentDocumentLink. The LinkedEntityId points to the task record. Now, if a certain update happens to a parent record then i am trying to update only ...
0
votes
1answer
615 views

How to query ContentDocumentLink in SOQL and then upsert records in Data Loader

When querying ContentDocumentLink in SOQL using the following query, an error is thrown. Goal: We are attempting to get a spreadsheet of the data so we can update IsDeleted flag with TRUE on entries ...
0
votes
1answer
38 views

Replace Content Notes in bulk or replace ContentDocumentLink

We are looking for a way to either replace Content Notes in bulk (the wrong .txt files were linked, however the metadata is correct), or replace the ContentDocumentLinkIds while removing the old ones. ...
0
votes
2answers
72 views

Make the test work: File insert, check this File

This code is a controller for my VF Page. It inserts ContentVersion and ContentDocumentLink. After that a candidate field Photo__c take a ContentVersion.Id value. How to check it correctly? Now ...
1
vote
0answers
50 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 ...
0
votes
1answer
399 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
2answers
435 views

Unable to extract bulk ContentVersion and ContentDocumentLink data using Salesforce API

Use Case: Transfer existing (and OOTB) Files that are linked with couple of custom objects (CO 1 & 2) to another Custom object (CO X)? The new custom object (CO X) has look up fields for CO 1 &...
0
votes
1answer
169 views

Not able to insert public group id as LinkedEntityId in contentDocumentLink object

I have written one trigger which makes file private on the creation and has another trigger which shares the file access to a public group, but the second trigger is not working since, when I try to ...
1
vote
1answer
460 views

ContentDocumentID is not available just after ContentVersion getting inserted But available after soql query

I am inserting ContentVersion as following:- String yourFiles = 'Lets assume this is your binary string of the files'; ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; // S ...
3
votes
1answer
195 views

Why is this ContentNote trigger receiving 1 record at a time even though multiple records are being inserted?

I am seeing a ContentNote trigger called on individual rows even though a bulk insert is done. A stripped down version follows. The debug log output demonstrates that 3 ContentNote objects are ...
0
votes
1answer
45 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 ...
2
votes
1answer
211 views

“Unable to create/update fields: VersionData” error when updating a ContentNote from Apex

I have some Apex code that inserts a ContentNote and the corresponding ContentDocumentLink. This works fine and the data can be viewed through the normal Salesforce UI. But some further code that ...
0
votes
1answer
220 views

How to import contentversion records(csv file) using dataloader

i have three records in csv file and three pdf files. how can i import these content version records to sandbox. i tried, but when i am uploading csv file using dataloader, i got Required fields are ...
7
votes
1answer
266 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
vote
0answers
81 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?
4
votes
1answer
332 views

Generate a Public Accessible link from ContentDocument

My Client wants to upload Image files from Account and generate a link for this image file and save it in a custom field on Account. This link should be Public Accessible (access from outside without ...
4
votes
0answers
298 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 ...
4
votes
0answers
634 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@...
4
votes
2answers
328 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[]{'heim@elastify.eu'} ); m.setSubject( 'test' ); m.setHtmlBody( ...
2
votes
2answers
482 views

ContentNote not inserting

I am trying to insert a new ContentNote and link it to an opportunity with ContentDocumentLink. However, after inserting the content note, the ID returns as NULL, so referencing it in the ...