Stack Exchange Network

Stack Exchange network consists of 174 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.

1
vote
2answers
59 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
20 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
17 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 ...
2
votes
1answer
49 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
44 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
70 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
110 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
26 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
31 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 ...
0
votes
0answers
29 views

Save uploaded image even after page refresh

I need to make an VF component with image. All is great, but this image (preview) disappears after page refresh. How can I fix it? Controller: public class uplClass2 { public string recId{get;set;} ...
1
vote
0answers
27 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
105 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> ...
0
votes
0answers
25 views

Error while uploading new file via notes and attachments in lightning- 'Cant upload 1 file'

There is a trigger on ContentDocument which prevents update and delete of uploaded files via notes and attachments to an object. It is working fine. But I am unable to upload new files. It is ...
1
vote
2answers
153 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
51 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
161 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
110 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
36 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
76 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
96 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 ...
5
votes
1answer
79 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
34 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?
3
votes
1answer
208 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 ...
2
votes
0answers
158 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 ...
2
votes
0answers
211 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
202 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
167 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 ...
0
votes
1answer
266 views

Error with ContentDocumentLink insert

I am receiving this error when I try to create a Note and inserting it to an opportunity. The opportunity is valid and there is no documentation of requiring the field, "document" for ...
0
votes
0answers
9 views

Where to see number of content-delivery viewed in a 24-hour period?

I am getting the error as attached when viewing a document in the SFDC library. As I am aware that As per Salesforce limits, the total number of content-delivery views allowed within a 24-hour period ...
2
votes
0answers
134 views

ContentDocumentLink - Can't set Visibility:InternalUsers when linking to case in specific sandbox

I have to push about 40,000 files into Salesforce as case files for a go live cutover. I have a process which creates a ContentVersion and then a ContentDocumentLink. In one sandbox, the files are ...
3
votes
2answers
465 views

SOQL ContentDocument: Ids not returning

A handful of our users have created notes on contact and opportunity objects that we are trying to port over. They are currently saved as ContentDocuments - but I also want to pull what objects the ...
0
votes
1answer
59 views

Query to retrieve certain files from Product2

I have the following use case: A web shop (Java) retrieving products from SF using the SOAP API. Attached "Files" are retrieved and displayed by selecting them through ContentDocumentLinks related to ...
1
vote
0answers
490 views

ContentVersion trigger event AfterInsert -> Insert ContentDocumentLink -> FIELD_INTEGRITY_EXCEPTION

We need to get a solution / workaround to insert in ContentDocumentLink several links when a File that has just been inserted (ContentVersion) and sibling records of other Custom Object. A third ...
0
votes
0answers
16 views

How to render an image uploaded in Salesforce file in visualforce email template?

I want to render an image which is uploaded to Salesforce files in a visualforce email template. However I am not able to display that Image, any help is highly appreciated. Thank you in advance.
-1
votes
1answer
61 views

Add a version of file to a existing file version(ContentVersion)

I am trying to attach a versions of file with content Versions to a existing content version, i don't know how to do that... actually i arrive to insert file but some duplicate file is present and i ...
0
votes
1answer
223 views

Scheduled Data Export: how to obtain ContentVersion linking data

I've used the Data Export feature to pull down ContentVersion data for Files and (Enhanced) Notes from a Salesforce org that's being migrated into a different org. I've been unable to locate the ...
0
votes
0answers
220 views

Convert legacy attachments into the files

I need help to convert legacy attachments to files with lastmodifieddate of file is equal to created date of attachments by using apex code. I need to do it for all objects on which attachments are ...
0
votes
1answer
217 views

File SOQL query

I need to search for Partner Accounts that don't have a Partner Agreement attached in the Files section. To find that, I believe the best way is to get a list of all Files attached to the Accounts ...
1
vote
0answers
131 views

How to show error msg in ContentNote?

I want to show error msg whenever notes get created without attaching to any records. As trigger on ContentNote is not available I've written Trigger on ContentDocumentLink, but I am not able to show ...
0
votes
1answer
121 views

Public guest user can't access ContentDocuments

I have a site with a Visualforce page that requires access to ContentDocuments linked to an Opportunity. My problem is that i can only see, as a public guest user, content documents that are uploaded ...
0
votes
0answers
294 views

Understanding ContentDocumentLink object API

As per documentation, I am trying to understand the following point - "For organizations with Communities enabled, a document can only be shared with users and groups that are a part of the community ...
0
votes
1answer
87 views

Prevent deletion of ContentNote

Is there anyway to prevent a user from deleting a New Note, based on the status of the Opportunity that the contentnote is linked to? The requirement is that I have a datetime field that is set, once ...
1
vote
2answers
700 views

How Content Document Should be Associated with Custom Object

I am trying to create File through ContentDocument . Once File is created want to associate with Custom Object Want to understand what is best way to associate File with Custom Object Use FeedItem ...
1
vote
0answers
353 views

Internal Salesforce.com Error while executing batch class

I want to create a batch class for the ContentdDocumentLink. I am getting records in the querylocator. But the execute() method is not working. In the debug logs also I am not able to trace any ...
0
votes
3answers
2k views

ContentDocumentLink insertion fails

I want to share all records with admin user using next trigger: trigger ContentVersionTrigger on ContentVersion (after insert) { system.debug('sdfsdf' + Trigger.new); for (ContentVersion ...
4
votes
1answer
338 views

How to prevent duplicate File (ContentDocument) if the same file is uploaded at multiple records?

This is a day-to-day use case: Assume there are many Opportunities on an Org. Now Sales-Reps are uploading some auxiliary information as Files in Lightning using the standard related list and there ...
0
votes
0answers
74 views

How do I share files wtih a chatter group automatically via a trigger?

When I upload a file via the chatter feed I want that the file is shared with a particular group in my org with contributor status. I think it must be a trigger on the ContentDocumentLink and a after ...
0
votes
2answers
744 views

LinkedEntityid is the user incorrectly coming in ContentDocumentLink trigger

I am creating a trigger on ContentDocumentLink and I am attaching a file via upload file option in related list to a record. In trigger(after insert), the linkEntityId is generated as user id but I ...
0
votes
0answers
142 views

Why ContentDocumentLink reference user?

I need to add copy of Service Report when it is created in Service Appointment to its parent. To do so I tried to create trigger on ContentDocumentLink. My idea was to get this ContentDocumentLink, ...
5
votes
0answers
256 views

USING SCOPE Everything not working

I wrote a trigger on ContentDocumentlink to get a count of number of files uploaded against Service_Request__c (Custom Object) record.It works fine for new files are uploaded on Service Request record....