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 [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
1answer
17 views

ContentDocumentLink Throws an error using ContentVersion Object “ContentDocument ID: id value of incorrect type”

today i'm trying to upload some files to SF using Content objects. I already uploaded the ContentVersion record and the image is in SF now. The problem is when i try to upload the ContentDocumentLink ...
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 ...
1
vote
1answer
56 views

How to dynamically display a content document image on a site

I have created a dynamic url to display a logo image from content document. I uploaded the image and logged into the org and can see the image. When I use an incognito window the link gets broken but ...
0
votes
0answers
7 views

Download ContentNotes linked to entities by others

I have an org with SNotes enabled. I am trying to use REST API to query SNotes on Account. If the current user adds an SNOTE, then a simple SOQL query like so returns it: GET /services/data/v42.0/...
0
votes
0answers
29 views

Performing multiple operations on same record in same transaction [duplicate]

I am trying to do three operation using same record. First Operation: Set ContentDocument isArchived field to false. Second Operation: Grab contentdocument by calling REST API Endpoint. Third ...
0
votes
0answers
24 views

Attachment's Name field changes after converting to Lightning Files

I am using the tool Magic Mover to migrate Classic Attachments to Lightning files. However, after conversion of an Attachment to a Lightning file, the Attachment's 'Name' field changes. The ...
2
votes
0answers
32 views

Is it possible to download archived contentversion or contentDocument

I am having a hard time downloading a contentversion/contentdocument where contentdocument is already archived. I am trying to download the file by hitting rest endpoint services/data/v44.0/...
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 ...
3
votes
2answers
50 views

Does deleting a ContentDocument delete attached ContentDocumentLinks?

Does deleting a ContentDocument delete associated ContentDocumentLinks?
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 ...
0
votes
1answer
38 views

DocumentAttachmentMap Query for Attached File

I can attach a file to a Lightning emailTemplate using one of the emailTemplate editors in Salesforce but I have not been able to find the attachment record that makes this relationship possible. If,...
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 ...
0
votes
2answers
52 views

How to make a Salesforce file private using Apex

My requirement is to make a Salesforce file private using Apex. I tried to update the PublishStatus field (on ContentDocument), but this field is not writable. Any idea?
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
21 views

Image Formula Fields in HTML Email Template

Trying to put a Formula Field Image on an Email template so to have images unique to the Account. So Email templates replaces & with & thus the parameters in externally shared links from ...
1
vote
1answer
57 views

Upload file and attach it to contentDocument

I'm trying to develop a functionality that upload files and attach it to my opportunity ContentDocument (and not attachment) like my standard component do . I'm wondering when i'm saving my uploaded ...
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
1answer
47 views

Create Notes(content documents) preventing the edit and Delete on notes

i need an option to create a note preventing the edit and delete on notes for a particular custom object. i wrote a below trigger .. but it is restricting to create a note also. trigger NoteTrigger ...
0
votes
2answers
34 views

Can two Case sobjects have the same child ContentVersion?

I am trying to delete a ContentDocument under Case sobject safely. In order to do so I will delete the Case's related ContentVersion's ContentDocument, which will delete the ContentDocument and its ...
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
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
1answer
22 views

Not getting a value from SOQL query as expected when using a bind variable

public class ELOUpload_Class { public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) { //Create a set of all the incoming IDs Set<Id> contDocId = ...
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
49 views

Cannot able to get ParentId from ContentDocument

I have a below code to retrieve parentId of content document after insert on ContentVersion. //get blob body content from ContentVersion for(ContentVersion cVersion : [SELECT Id, versionData,...
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
29 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
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
1answer
44 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
41 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
161 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
1answer
161 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
70 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
2answers
420 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
59 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
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 ...
6
votes
2answers
64 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
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
951 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
614 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. ...
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
88 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
47 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 ...