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.

-1
votes
0answers
12 views

Facing Problem in displaying the contents in salesforce

In Library, I have lots of documents. I need to view that documents. Used content document Object. But I am not able to view that document in community. <aura:attribute name="ContentIds" type="...
0
votes
0answers
14 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
46 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
0answers
15 views

How to add ContentDocument attached file from record to another?

I have a requirement to include an image attachment from a Work Order record to its parent opportunity when it is added to the Work Order, and then add this image to another new Work Order. As per ...
0
votes
1answer
25 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
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 ...
6
votes
2answers
48 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
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
127 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
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
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
21 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 ...
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 ...
-3
votes
1answer
34 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
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
160 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 ...
4
votes
0answers
43 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: ...
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 ...
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
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( ...
0
votes
1answer
265 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
31 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
33 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
288 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
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 ...
0
votes
1answer
21 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 ...
1
vote
1answer
2k 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
24 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
36 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
1k 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
21 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
810 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
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 ...
0
votes
2answers
43 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
974 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 ...
1
vote
0answers
112 views

Some ContentDocument is not returned by the query

I am facing a weird problem on the Files. Am trying to get all the ContentDocuments shared with "Any user in your company" with "Viewers" permission and change the access to "No Access". If we ...
1
vote
1answer
785 views

Content Document Link: FIELD_INTEGRITY_EXCEPTION, Document with ID: *** is already linked with the entity with ID: ***: Linked Entity ID:

I have a trigger on contentversion object which inserts contentdocumentlink to share files specific user whenever a new file is uploaded. If I try to upload a new version to already existing file, I ...
1
vote
1answer
2k views

Difference between Attachments and ContentDocument [closed]

I am trying to be able to download a file blob attached to a Case. I was first looking on the attachments table for the id of the file and realized it wasn't there and it was in ContentDocument. The ...