You need to sign in to do that
Don't have an account?
Nirdesh_Bhatt
Display cases using LWC
I am trying to display cases based on the Account selection
.html <template> <h6> Showing Cases based on Account Selected on this Value Plan</h6> <lightning-datatable data={data} columns={columns} key-field="Id"> </lightning-datatable> </template> -------------------------------------------------------- .js import { LightningElement ,api,wire,track} from 'lwc'; import getAllCase from '@salesforce/apex/GetAllCases.getAllCase'; export default class DatatableEx12 extends LightningElement { @track columns = [{ label: 'Case Number', fieldName: 'CaseNumber', type: 'Auto Number', sortable: true }, { label: 'Subject', fieldName: 'Subject', type: 'Text(255)' }, { label: 'Status', fieldName: 'Status', type: 'Picklist' }, { label: 'Case Type', fieldName: 'Type', type: 'Picklist' } ]; @track error; @track data ; @api recordId; @wire(getAllCase) wiredOpps({error,data}) { if (data) { this.data = data; console.log(data); console.log(JSON.stringify(data, null, '\t')); } else if (error) { this.error = error; } } } -------------------------------------------------------- public with sharing class GetAllCases { @AuraEnabled(cacheable=true) public static List<Case> getAllCase(String accountId) { this.acnt= (Account)controller.getRecord(); Account acc = [Select id FROM Account where id = :acnt.id]; } }
Barbara Campbell 3
Peryourhealth (http://peryourhealth.club/)