Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
0 answers
74 views

Why doesn't ContentVersion Query doesn't respect OFFSET when you include VersionData?

I have some code where I have to be careful about how much ContentVersion data I load into memory at any particular time to avoid blowing the heap limit. I was planning to do an initial query on ...
Aidan's user avatar
  • 14k
0 votes
0 answers
334 views

SOQL nested query ContentVersion, ContentDocument, ContentDocumentLink

I am trying to access ContentVersion, ContentDocument, ContentDocumentLink to achieve a count of each contentversion per object. The relationships between the objects I activated QueryAll Document, ...
Art's user avatar
  • 11
0 votes
2 answers
1k views

Not getting any records from ContentVersion in Salesforce SOQ query which we are not owner of

When I am creating a new record (release), I would like to get a file off a related record (inventory) and then create a copy of it on the release. The problem I am facing, is that this only works if ...
Finbar Tracey's user avatar
0 votes
1 answer
66 views

Mistake is SOQL query

When I searck content document by Id I see the result, but when I search by title the result is missing. The problem appears when someone else create document. When I create documents, everything is ...
Yauheni's user avatar
  • 29
0 votes
1 answer
929 views

Sorting ContentVersion based on Related objects like Account, Contact

I want to build a photo gallery where I can sort Images based on accounts, contacts or any other object. But not able to do so due to Data model of ContentVersion/documents. I can't sort ...
Manjot Singh's user avatar
  • 3,586
0 votes
1 answer
3k views

Problem Querying Fields on ContentVersion When User is not the Owner

UPDATE This can reproduced in any org, so it may be designed behavior or a bug. Basically, if a user is not the owner of a ContentVersion record they will only be able to filter by Id or ...
Andrew L.'s user avatar
  • 871
0 votes
0 answers
575 views

The field VersionData not queried in SOQL for ContentVersion sobject

I queried the ContentVersion object by following soql, VersionData field is not retrieved in results. SELECT Id, Title, VersionData, PathOnClient, ContentSize FROM ContentVersion WHERE Id=<Id> ...
Satishakumar Awati's user avatar
1 vote
0 answers
1k views

Sub-query issue on ContenDocument and ContentVersion

I have a list of ContentDocument IDs which are all tagged to the same Sobject, when a ContentDocumentId is selected, I want to retrieve only its latest ContentVersion data based on the ...
Hengky Djapar's user avatar
4 votes
0 answers
71 views

ContentVersion queries omitting recent records unless queried by an ID field

We are seeing a very strange behavior in a Summer '21 sandbox. Queries for ContentVersion will not return "recently" created records, unless queried by an ID or relationship. For example: ...
Jason Clark's user avatar
  • 12.1k
4 votes
2 answers
690 views

How to replicate the functionality of delivered "File Engagement" lwc card?

In our org we have a need to programmatically replicate the functionality of delivered “File Engagement” component/card. Here is a snapshot from our live org, on a ContentDocument view page: Since ...
kivanconer's user avatar
0 votes
1 answer
1k views

Relationship between ContentDistribution and ContentDocument build SOQL query

Is there a way to query ContentDistribution and ContentDocument ? I'm looking to pull few fields from ContentDocument while building the ContentDistribution query. Here is what I have done so far: ...
Nick's user avatar
  • 7,153
0 votes
1 answer
3k views

Content Version SOQL - WIth custom field in the Where clause Return as null

I have a custom field on Content Version - but When I try to have a SOQL and receive the data its return as null. The next line is working : ContentVersion testContentInsert = new ContentVersion(); ...
Salvation's user avatar
  • 1,209
2 votes
2 answers
8k views

Any way to Query for LinkedEntityId from ContentVersion

Wondering if there is anyway to query for LinkedEntityId from ContentVersion? As i understand, ContentVersion looks up to ContentDocument which then looks up to ContentDocumentLink (could be wrong ...
Bobbygllh's user avatar
  • 741
0 votes
1 answer
2k views

How to add a filter in query to only fetch specific files

I am running a SOQL query on contentversion to fetch files that are attached to opportunity. However, I am noticing that it is even pulling the notes attached to the opportunity as well. Is there a ...
Anonymous's user avatar
0 votes
1 answer
2k views

How do I display Opportunity ID/LinkedEntityID in content version object

I am running a query on contentversion to fetch files related to opportunity from Salesforce. However the content version records returned from the query does not tell me what opportunity id is that ...
Anonymous's user avatar
0 votes
1 answer
2k views

How to create a nested query that fetches opportunities, Content Document and Content Version [duplicate]

I am trying to fetch all files that are associated with the opportunities in 'XYZ' stage. I am trying to construct one nested query that would first fetch all the opportunities in that stage, then ...
Anonymous's user avatar
1 vote
1 answer
1k views

Why am I getting a path instead of a file when I query for VersionData on ContentVersion?

When I query for VersionData from a ContentVersion record, I get "/services/data/v44.0/sobjects/ContentVersion/0681F000000QY0eQAG/VersionData" in the response. I'm expecting a base64 encoded file. ...
Ian Horner's user avatar
4 votes
1 answer
7k 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 ...
Prakhar Saxena's user avatar
6 votes
2 answers
493 views

Query optimization for ContentVersion

For a project I wrote a query to get all needed ContentVersion records. But after the deployment to full sandbox we have seen the performance issues with it. It only happens for the first time, all ...
Novarg's user avatar
  • 5,294
3 votes
2 answers
4k 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 ...
ZAR's user avatar
  • 2,043
3 votes
1 answer
289 views

Is there a limit for number of content folders?

I am getting this error when I try to create a content folder using a visual force page(by inserting a record in contentfolder. As per this link, there should not be any limit for the number of ...
Saranya's user avatar
  • 516
0 votes
0 answers
389 views

SOQL on ContentVersion results in 'invalid parameter value'

I am writing a query to upload the contentversions which are not present in my Organization. For this, I am checking the presence of contentversion if it exists or not. This hit a snag where the query:...
dmachop's user avatar
  • 1,089
0 votes
1 answer
711 views

map.keySet() or Set<Id> not returning content notes related to an Event

Requirement I have to fetch all the content Notes that are associated to events created after 01-Aug-2016. Logic path I have taken the following path to get to content notes fetch events find ...
Mahmood's user avatar
  • 6,006
15 votes
3 answers
26k views

ContentDocument parentId

I am uploading a file via the Files related list on the Contact detail page. When I query (SOQL) the database I see the relevant ContentDocument and ContentVersion records. I would like to get the ...
Dedo's user avatar
  • 5,017
10 votes
1 answer
232 views

SOQL: (WHERE x IN(a,b)) does return 2 records, but (WHERE x = a OR x = b) returns only 1 record... Why?

I'm trying to retrieve some ContentVersion records, but I'm having a lot of issues with it. After some research it seems as if the records are divided into two 'sets' as it were, and Salesforce in ...
Willem Mulder's user avatar
3 votes
1 answer
1k views

Apex Query on ContentVersion object and get all record

Apex Query on ContentVersion object and get all records, but the record are coming on current login user owned, not all records are coming. for example i am login with administrator account and want ...
Faisal's user avatar
  • 847
1 vote
1 answer
616 views

Can we query Library member permission and information about which type of permission member held?

Can we query Library(ContentVersion) member permission and information about which type of permission member held ? Manage Library Add Content Add Content on Behalf of Others Archive Content ...
Ankuli's user avatar
  • 700
2 votes
2 answers
9k views

Get all documents in content belonging to a particular library in SOQL

I need to get documents of a particular library using SOQL. SELECT title FROM ContentVersion where Contendocument.Parent.Contentworkspace.name='EMEA Sales' The error i get is INVALID_FIELD: on ...
Prady's user avatar
  • 12.4k
8 votes
2 answers
779 views

Query Chatter Comment Files for a group of records

My question is similar to this one except that I need the files for a group of records, making the solution of querying ContentDocumentLink unworkable, because it requires a single Id for the where ...
Daniel Blackhall's user avatar