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.

Filter by
Sorted by
Tagged with
1
vote
0answers
15 views

ContentVersion FirstPublishLocationId, specify ShareType `I`

If i create a ContentVersion e.g. via Apex like so ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; conVer.PathOnClient = fileName; conVer.Title = fileName; conver....
0
votes
1answer
19 views

ContentDocumentLink Sharing

I am trying to share a file that is uploaded to Parent record with a child record. So I assumed I could create a ContentDocumentLink handler to do this. But the examples I have read reference the ...
0
votes
1answer
29 views

Apex Class on ContentDocumentLink

I'll start off by saying that I am in no way a Developer, and the code I am posting is from things I have found online and recycled for my use-case. It's working, but I know it's not structured ...
0
votes
0answers
26 views

Unit test on ContentFolder

I have this simple code: public static void toFolder(ContentDocument doc, ContentWorkspace cw, String folder) { // Getting the folder of the library ContentFolder libCf = [ SELECT Id, Name ...
0
votes
1answer
16 views

Count Number of Pages in Salesforce Files

Is there any way to count the number of pages in apex if a file of PDF type is stored in Salesforce?
1
vote
1answer
24 views

How often is the number of downloads updated for a shared file?

I have been experimenting with list-emails with an attached file (the attachment is automatically replaced by Salesforce with a link to a preview/download location). I have personally downloaded a ...
0
votes
1answer
29 views

Retrieve the Record type name of the Related entity ID in Trigger

I am trying to get the record type name of the related/linked entity id in the trigger of the Content Document Link like below trigger setVisibilityOnNotesinCase on ContentDocumentLink (before insert) ...
0
votes
1answer
31 views

Convert XLSX into CSV in Apex [closed]

We are having some hard time converting a ContentDocument of type XLSX into CSV inside Salesforce APEX code. What we are looking for is a way to convert the stored XLSX file into SF to be converted ...
0
votes
0answers
22 views

Document CheckList and Einstein Form Reader Permission Sets not available on Winter'21 Preview Instance

I am trying out the 'Intelligent Document Automation' feature that has come in Preview Instances of Winter'21 Release. For using this feature, there are certain Permission Sets, Settings that need to ...
0
votes
1answer
16 views

ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator

I am trying to get list of all the ContentDocumentLink which are not available in a set. But when I try to get NOT IN its giving error Implementation restriction: ContentDocumentLink requires a filter ...
2
votes
0answers
52 views

SOQL Query Returning Zero Rows on ContentDocumentLink (filtering on LinkedEntityId)

For my specific use case, I need to find all Content Documents on specific object records that meet a business requirement. However, when I filter by linkedEntityId on the contentDocument my soql ...
1
vote
1answer
29 views

Image is displayed upside down in Visualforce page rendered as PDF

I am facing a bizarre issue. I am creating a PDF dynamically using images stored in the system. I am using a VF page and using RenderAs="pdf" to generate the file. Everything is working as ...
1
vote
1answer
29 views

Connect REST api to add existing file to existing folder — like ContentDocumentLink

I'm (successfully) uploading a file to the /connect/communities/{community}/files/users/me endpoint. I'm able to share that file with a specified user by creating a file share /connect/communities/{...
0
votes
0answers
16 views

blob.toPDF doesn't format text

cv.VersionData = blob.toPDF(Stringvalue); is creating a pdf with bold characters, how do I save the format in the same way that I'm passing from JS?
1
vote
1answer
37 views

Downloading all documents through the URL hack gives “This content pack is empty…and cannot be downloaded” error

Based on some answers and google searching, I've understood that all content documents attached to a record can be downloaded if a url is with '/' separated content document IDs formed as below : ...
0
votes
0answers
16 views

Why Chatter Posts are getting deleted when Content Document Record deleted in Apex

We have requirement that whenever ContentDocumentLink is inserted, Post to Chatter and delete the ContentDocument. But once we delete the ContentDocument record, inserted Chatter post also getting ...
-1
votes
2answers
50 views

System.QueryException: Implementation restriction: ContentDocumentLink?

I have been following this to create a lightning component for lighting:file upload. As you can see there's comments on how to avoid the System.QueryException yet I still am getting it? picture of ...
1
vote
2answers
92 views

How to automatically change the name of a file upon creation?

I want to automatically change the name of a file as soon as it is created. To keep things simple, let's say I want to add "test-" before the file name. I think this has to be done via a ...
0
votes
1answer
22 views

Is there a way in salesforce using soql where we can get documents owned by other users but not necessarily shared to me?

I want to collect all the documents owned by each User in Salesforce account. I have created accessToken with User A's email, where User A is a System Admin with property PermissionsModifyAllData and ...
1
vote
0answers
44 views

Delete a ContentDocumentLink of Library file

I have inserted a file in Library. I want to delete the ContentDocumentLink by which it is shared with the Library. I have created new ContentDocumentLink where I have shared file with a user. But ...
0
votes
1answer
20 views

When and If, Does the 'version' in ContentVersion Change?

I'm using the lightning-file-upload component to upload files (wow). My question is: is it safe to add a custom lookup relationship on the ContentVersion object? I guess I don't really understand the '...
1
vote
1answer
36 views

Insufficient privilege error when deleting Salesforce Files (ContentDocument) from Web service call

I am unable to successfully delete a file from Salesforce with Apex when executed as a web service call from an external service. Running the following code behaves differently depending on whether it ...
0
votes
1answer
147 views

Cannot view Content documents with Site guest user. Can view standard notes and attachments

Have a scenario where I need to show files attached to the record on custom vf page of Site.com . Unfortunately there seems to be no access for guest users to content document. We can use standard ...
0
votes
2answers
62 views

Trigger on ContentDocumentLink is not firing

All, I am writing this trigger to prevent the deletion of attachment and notes for cases whose status is completed. But it's not getting fired. Please help. trigger PreventDeletion on ...
0
votes
0answers
23 views

Migrate Attachments as a Content Document in other org

I am migrating the data from one org to another org. Let's assume Source Org as S (from where I need to migrate the data) and Destination Org as D (where I need to insert the Data). Now in org S, ...
0
votes
1answer
58 views

Receiving ILLEGAL_OPERATION error on EmailMessage Update from ContentDocumentLink trigger

I've been trying to make a fix for a known error when logging emails from the Outlook integration where embedded images display as broken links in the feed. My solution for this would be a trigger ...
0
votes
0answers
13 views

Creating Trigger for ContgentNote / ContentVersion etc. to capture Content Body?

I'm looking for the best approach to capture the BODY of a Content Note (Content Document) object when one is inserted or updated. I've enabled the new lightning notes feature in some of my sobject ...
7
votes
2answers
277 views

ContentDocument Preview in LWC in Communities. Is there a ConnectApi.ContentHub.getFilePreview Equivalent?

I'm trying to create a custom version of the File Preview Modal that appears in Lex when using this approach: Using Navigation Mixin with a page name of 'filePreview'. That approach doesn't work in ...
4
votes
1answer
467 views

How to download files, documents (attachments) in salesforce via apex?

I want to download all files associated with records (single or multiple records) of a particular object at one click, using apex. Let's say that there is a custom object myVehicle which holds ...
0
votes
2answers
131 views

Prevent files from being duplicated ContentVersion - ContentDocumentLink

I have button, when click on it, it'll generate a doc and stock it in Files I want to > when i click on that button again, the doc will not be duplicated Code ContentVersion contVer = new ...
0
votes
2answers
87 views

Download ContentDocument in Community redirect to maintenance site

I'm trying to download a ContentDocument from community, here is the url: String downloadUrl = Url.getSalesforceBaseUrl().toExternalForm() + '/sfc/servlet.shepherd/document/download/' + ...
0
votes
2answers
84 views

How do you get parent record in ContentDocument?

I'm able to query ContentVersion, ContentDocument and other Content objects but I'm unable to find the relationship from File to an object, for instance Opportunity. I'm working on exporting these ...
0
votes
0answers
38 views

ConnectApiException :The file you uploaded doesn't appear to be a valid image

I'm using this code to create a document and use it to get fullPhotoUrl field in a test class but I got the error : ConnectApiException :The file you uploaded doesn't appear to be a valid image could ...
0
votes
1answer
119 views

Inserting contentdocumentlink in contentdocumentlink trigger throws errorDocument with ID: xxx is already linked with the entity with ID: xxx:

the requirement is when an file is added not uploaded to event that is associated with some opportunity, i want that file gets associated with opportunity as well And when we add a file "it somehow ...
3
votes
0answers
51 views

How is the IsReadOnly attribute used on ContentNote?

I'm trying to create a read-only "enhanced note" and I see that there is a property on ContentNote for IsReadOnly which would work perfectly for the use case but unfortunately: Line: 1, Column: 17 ...
0
votes
1answer
28 views

How to subscribe to a ContentDocument using API?

I am trying to develop a Custom UI for subscribing ContentDocument and found out that we have ContentSubscriptionObject which stores subscription information of the document. However we cannot insert ...
0
votes
0answers
56 views

Transfer Notes and Attachments from One Object to Another

need help figuring our my batch job that moves Notes and Attachments from one object(dsfs__DocuSign_Status__c), to its related Account, then delete the notes and attachments after they are moved. I ...
0
votes
1answer
97 views

Permissions for Flow Users on ContentDocuments

I have a signature capture screen flow that allows us to get digital signatures for users. When testing as a system admin everything worked as expected but when running as a user they don't appear to ...
0
votes
1answer
118 views

Bulk Upload Attachments into Lightning Knowledge Articles

I would like to bulk upload list of pdfs as attachments against knowledge articles. I think the documents are getting stored in ContentDocument, but how can I use dataloader to load attachments and ...
2
votes
0answers
93 views

LWC download ContentDocument with alternative name

I have a LWC component where i render some ContentDocument information. If the user goes to /sfc/servlet.shepherd/version/download/ContentDocument.LatestPublishedVersionId (e.g. by clicking on a ...
0
votes
0answers
43 views

How to get image link from DistributionPublicUrl (outside Salesforce)?

I need to display pictures outside salesforce so Im generating DistributionPublicUrl from ContentDistribution but the 'DistributionPublicUrl' its a page with the picture but its not the picture. Cant ...
2
votes
1answer
120 views

Test Class for ContentDocumentLink causing Internal Salesforce Error

I have a test class that is inserting a ContentDocumentLink between a ContentNote (SNOTE) and a custom object. Everytime I try the insert it causes an Internal Salesforce Error. I have absolutely ...
0
votes
2answers
40 views

How can I mark a contentDocument or ContentDocumentLink?

I made a lightning web component to set if a content document it is approve or reject but I cant create any field in this objects... There is a way to mark if a Content document was approve or reject ...
0
votes
0answers
61 views

How to delete ContentDocument records which is associated with its Parent record , based on Parent Field value?

Parent Object: ccrz__E_OrderShipment__c Field: Status: Cancelled / completed /Process Currently we are deleting the attachment (Doc) which is 180 days old. Now we need to add one more condition that ...
0
votes
0answers
36 views

Prevent Duplicate files - ContentVersion

I have button which is linked to VisualForce page I don't want the files to be duplicated once i click on that button , Can anyone help me on that please? if(!test.isRunningTest()) body = pdf....
0
votes
1answer
59 views

How do i get Archived files list on specific record?

One of my requirement is to list out all archived files on specific record so i have created one lightning component and i did following SOQL to get all archived files on specific record but it's not ...
0
votes
1answer
26 views

Can't retrieve non-customizable CustomObject named: ContentDocument

I have made changes to the record page of content document object, now I need to push the record page to other org. tried to retrieve the contentdocument object from vscode editor but receiving "Can'...
1
vote
1answer
48 views

Archived content documents not found in SOQL

This soql is not retrieving any records, any issue in soql ? SELECT Id, Title, FileType, ContentSize FROM ContentDocument ALLROWS WHERE isArchived = true
2
votes
1answer
77 views

Why Blob equals doesn't work if one of the Blobs is retrieved from ContentDocument?

In brief, I can't test the value stored in a ContentDocument. Even if the value of the two Blobs is the exact same, equals would return false. Do someone know the reason? Here's a unit test to check ...
0
votes
1answer
27 views

Delete all attachments at a time on a Particular Opportunity Record

I have to delete all attachments related to a particular Opportunity Record based on Id or Name. Currently, I am deleting them manually one by one. Is there any workaround to delete all attachments ...

1
2 3 4 5 6