function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NebexForceNebexForce 

Custom Related Content under Account RelatedLists

I have the below piece of Code to display Related Contents of an Account record on a visualforce page as a related List in attempt to replace the Standard Related Content related list and hide the action links on it, but it seems that I can't get the relationship query right on ContentDocumentLink!

Is there any other way to do this? Help Please…

 

acc = (Account)controller.getRecord();

List<Account> account = [select Id,Name from Account where Id=:acc.Id];                                                                                                                          

ContentLinks = [Select Id, SystemModstamp, ShareType, LinkedEntityId, IsDeleted, ContentDocumentId From ContentDocumentLink where LinkedEntityId=:acc.Id];

//ContentLinks comes up empty as the relationship (LinkedEntityId=:acc.Id) is not working

 

if(ContentLinks.size() > 0){

  for(ContentDocumentLink cdl : ContentLinks) dIds.add(cdl.ContentDocumentId);

}               

contentVers = [Select Id, Title, ContentSize, ContentDocumentId, LastModifiedDate,CreatedDate From    ContentVersion where AND ContentDocumentId IN:dIds];

Rahul_sgRahul_sg

Hi Plz make sure Acc.Id has a value by placing a debug statement.

 

Also, try changing your API version from 26 to 25.

NebexForceNebexForce

I did all that, acc.Id has value. I am not sure if LinkedEntityId is used for relation with Account?