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 [contentdocument]

Use this object to retrieve, query, update, and delete the latest version of a document, but not a content pack, in a library or a file in Chatter.

0
votes
0answers
14 views

Deleting an Asset file

I had an image in a rich text field in my Community. I was able to access the image file on the internet via the image's URL. I deleted the Asset File. However, it is still downloading when I ...
0
votes
0answers
16 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
39 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
1answer
25 views

Not able to delete all contentDocuments even as an admin in salesforce through apex

I am unable to delete the contentDocument(Files) owned by some other user even as an admin. I am trying it through apex. When I write a SOQL query it only retrieves records that are owned by me, if ...
4
votes
1answer
35 views

Trigger on ContentDocument showing identical values for Trigger.old and Trigger.new

I have a simple trigger designed to prevent updating the metadata for an existing ContentDocument but it's not working. Example code: trigger ContentDocument_PreventUpdate on ContentDocument (before ...
0
votes
1answer
15 views

How to delete ContentDocument records associated with Agreements record

As parentId in ContentDocument records is null, i am unable to locate and delete the records associated with Aggreements records. Is there any way to relate records between these two objects without ...
0
votes
0answers
42 views

Change layout of Content Document record page (Community)

I've got a Salesfore Partner Community where the user can load files (ContentDocument) and view their details. I would like to edit the record page of ContentDocument object to remove related list. If ...
0
votes
0answers
21 views

Force.com upload file via API from guest user

I am building a visual force page that sends a file from the org to our 3rd party server that modifies the file as per instruction. So far that is working fine. I need to return that document from ...
0
votes
1answer
141 views

lightning:fileCard No Preview Available or What permissions am I missing?

Here's my code: <lightning:layoutItem padding="around-small"> <lightning:fileCard fileId="069XXXXXXXXXXXX" description="logo"/> </lightning:layoutItem> I'm using (for now) a ...
0
votes
1answer
33 views

How to add download functionality for related Files of a particular object record on custom VF Site page?

On Salesforce standard page for a particular record, all related Notes, Attachments and Files are shown under "Notes & Attachments section". I have a similar use case where, where on a VF site ...
1
vote
1answer
30 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
137 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 ...
6
votes
2answers
53 views

Workaround for the one record at a time trigger invocation when starting from Content Note

I hit this platform problem a while ago Why is this ContentNote trigger receiving 1 record at a time even though multiple records are being inserted?. But today I've hit it again and now I need a ...
0
votes
1answer
85 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
132 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
304 views

Adding attachments in apex, convert the code to add Files

I was wondering if there is a simple to solve my issue, previously in apex one of the automation process was adding attachments from email, please see the code below. private void ...
0
votes
1answer
233 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
29 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. ...
1
vote
0answers
33 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
38 views

Salesforce Content Library Document Creation Insights

Good Morning! So while playing in the Sales force's playground, I came across an exciting toy(it might not excite someone) called content library. I have tried to understand how it works? who can ...
-3
votes
1answer
35 views

Need help for writting test class for method for extention controller [closed]

Sorry I am new with salesforce developer. I have written method for extension controller. I need help with writing test class for that method. with that method what it does is visualforce is renderas ...
0
votes
1answer
88 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
238 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
138 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
38 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
123 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 ...
5
votes
0answers
58 views

How to detect a size change for a ContentDocument or a ContentNote in a trigger?

Both ContentDocument and ContentVersion have a ContentSize field documented to be: Size of the document in bytes but after adding debug code to check that field for both types for these events: ...
6
votes
1answer
119 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 ...
4
votes
1answer
237 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
276 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
230 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( ...
0
votes
2answers
419 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 ...
4
votes
1answer
38 views

Getting ContentType for ContentDocuments?

The ContentDocument and the ContentDocumentVersion do not store a ContentType (MIME) like attachments did. I am trying to pass documents using an API and this information is needed to properly pass ...
0
votes
0answers
41 views

Converting ContentDocument to Document

This question is related to a previous question I wrote: Displaying image in Visualforce PDF I am trying to display an image in a PDF. After some more research I found the following link which ...
1
vote
1answer
370 views

Displaying image in Visualforce PDF

I am trying to display an image in my PDF but am unsuccessful. I am using files to attach the images. Can someone please find out where I am going wrong? Apex code: public class findImageAttach { ...
0
votes
0answers
10 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 ...
0
votes
1answer
23 views

Adding Retrievable Files to Custom Object?

I have a custom object called "Research" that has a "Notes and Attachments" section where users are to upload documents that represent research for that record. For other objects in our system, this ...
2
votes
1answer
3k views

How to retrieve the file content for a ContentDocument object?

Previously, on Salesforce Classic, when a file was uploaded, it was saved on the Attachment object table. This object had the Body field. On Lightning Experience, however, attachments are stored as ...
0
votes
0answers
23 views

Create a trigger on document upload to automatically share with link

Is it possible to create a trigger to automatically share with a link when a document is uploaded. I can then get the link via SOAP on the contentdistribution object. Thank you.
0
votes
1answer
29 views

Problem in Covert ( image,line break,Numbers) from blob into string on Visualforce page

I have written a code to convert the blob content into string to display it on Visulaforce page.Its working.But I couldn't able to show the image.I mage is also converted as string like : <img src=...
0
votes
0answers
43 views

Can you send a csv file from salesforce to an FTP server? [duplicate]

I figured that it would be possible to send a file to an ftp server using apex, but I am having some difficulty getting the contents of the file to send over. The files are saved as ContentDocument ...
1
vote
1answer
2k views

How to get ContentDocument file body blob in APEX

How to get ContentDocument file body blob in APEX. We can query ContentVersion but it give result like It gives some URL but I need blob of body. How can we get them.
2
votes
0answers
23 views

Searching ContentDocument with SOSL 'Name Fields' appears to return documents with the search string in the content

It looks like when I issue a SOSL statement against NAME FIELDS in ContentDocument, I get documents that have the search string in the content as well. I really need it to just search the name fields,...
0
votes
1answer
31 views

How to search through text file content, if it was uploaded in Files tab?

I uploaded a docx file in Files tab in lightning experience. Now I have to use it in Apex trigger, to check if Contact's Name is mentioned in this file. I know that in Salesforce classis you could use ...
0
votes
1answer
1k views

Retrieve contentDocument file - REST API

I am trying to pull in an attachment from a case in salesforce to a separate web application. I am able to get the ContentDocument properties but not the actual binary. Here is the endpoint I am ...
3
votes
2answers
578 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
76 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 ...
0
votes
2answers
49 views

Unable to revise ContentDocument created in Apex

When I try to create a Content Document (File) in apex, it creates one with no facility to revise or add new version. However if I use the UI to create a file it gives me a link to add new version. ...
1
vote
0answers
1k views

Best approach for uploading to Salesforce files via a Salesforce API

I need to load files into Salesforce via an API as part of some integration work. I want to be loading files as Salesforce Files (not attachments) so we can version files if need be and I also need to ...
0
votes
1answer
2k views

How do I create a new ContentDocument Version in apex?

I'm getting insufficient privileges error when I try to create a new version for an existing file in apex. Code used to create new version: ContentDocumentLink cdl = [SELECT ...