function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
<template> <lightning-card title="File Preview v3" icon-name="custom:custom11"> <div class="slds‐m‐around_small"> <template if:true={filesList}> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col"> <div title="Key">File Name</div> </th> <th scope="col"> <div title="Value">File Extension</div> </th> </tr> </thead> <tbody> <template for:each={filesList} for:item="keyValue"> <tr key={keyValue.Id}> <th scope="col"> <div>{keyValue.Title}</div> </th> <th scope="col"> <div>{keyValue.FileExtension}</div> </th> </tr> </template> </tbody> </table> </template> </div> </lightning-card> </template> import { LightningElement,api,wire } from 'lwc'; import cvRecords2 from '@salesforce/apex/contenVersionFilePreview.cvRecords2' export default class ContentVersionV3 extends LightningElement { @api recordId; wiredActivities; filesList =[]; @wire(cvRecords2, {recId: '$recordId'}) wiredclass(value){ this.wiredActivities = value; const { data, error } = value; if (data) { console.log(data) this.filesList = data; console.log('Data========> '+JSON.stringify(this.filesList)); } if(error){ console.log(error); } } } Apex public class contenVersionFilePreview { @AuraEnabled(cacheable = true) public Static List<ContentVersion> cvRecords2(String recId){ set<Id> SetIds = new Set<id>(); list<Account> lstAccount = [Select Id,(Select Id From Contacts),(Select Id From Opportunities) from Account where Id = :recId]; for(Account Acc : lstAccount){ SetIds.add(Acc.Id); for(Contact con : Acc.Contacts){ SetIds.add(con.Id); } for(Opportunity opp : Acc.Opportunities){ SetIds.add(opp.Id); } } List<ContentDocumentLink> files = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :SetIds]; List<ID> fileIDs = new List<ID>(); for (ContentDocumentLink docLink : files) { fileIDs.add(docLink.ContentDocumentId); } List<ContentVersion> docs = [SELECT Id,ContentDocumentId, FileExtension, Title FROM ContentVersion WHERE ContentDocumentId IN :fileIDs]; return docs; } }
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
All Answers
Please go through below link it has implementation similar to your use case.
https://www.w3web.net/display-account-related-contacts-in-lwc/
https://pritamshekhawat.wordpress.com/category/lightning-component/lightning-web-component/
If it helps please mark it as best answer.
Thanks!
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!