I'm fairly new to LWCs and Apex and am working on a requirement to build an LWC data table that can be accessed from a custom app page.
However, I'm running into the following error when trying to deploy into my scratch org:
LWC1503: "getUncategorizedDocuments" from "@Salesforce/apex/OnboardingReviewDocController1.getUncategorizedDocuments" is not a known adapter. (45:11)
HTML:
<template>
<!------Header------->
<div class="slds-tabs_card">
<div class="slds-page-header">
<div class="slds-page-header__row">
<div class="slds-page-header__col-title">
<div class="slds-media">
<div class="slds-media__figure">
<span class="slds-icon_container slds-icon-standard-opportunity">
<lightning-icon icon-name="standard:recipe" alternative-text="recipe" title="recipe"></lightning-icon>
</span>
</div>
<div class="slds-media__body">
<div class="slds-page-header__name">
<div class="slds-page-header__name-title">
<h1>
<span>Uncategorized Onboarding Application Documents</span>
<span class="slds-page-header__title slds-truncate" title="Recently Viewed"></span>
</h1>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <br/>
<!------/Header------->
<lightning-card title="Uncategorized Onboarding Application Documents" icon-name="standard:document">
<template if:true={onbAppDocs.data}>
<lightning-datatable key-field="Id"
data={onbAppDocs.data}
columns={columns}
onsave={handleSave}
draft-values={DraftValues}
hide-checkbox-column
show-row-number-column>
</lightning-datatable>
</template>
<template if:true={onbAppDocs.error}>
<!-- handle Apex error -->
</template>
</lightning-card>
</template>
LWC js:
import { LightningElement, wire} from 'lwc';
import getUncategorizedDocuments from '@Salesforce/apex/OnboardingReviewDocController1.getUncategorizedDocuments';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { refreshApex } from '@salesforce/apex';
// columns
const columns = [
{
label: 'Onboarding Application Document Name',
fieldName: 'Name',
type: 'text',
}, {
label: 'Document Type',
fieldName: 'Document_Type__c',
type: 'text',
editable: true
}, {
label: 'First/Last/DOB',
fieldName: 'First_Last_DOB__c',
type: 'date',
}, {
label: 'Onboarding Application Owner',
fieldName: 'Onboarding_Application_Owner__c',
type: 'text',
},{
label: 'UBO ID',
fieldName: 'UBO_ID__c',
type: 'text',
}, {
label: 'S3 Link',
fieldName: 'S3_link__c',
type: 'url',
}, {
label: 'Document Status',
fieldName: 'Document_Status__c',
type: 'text',
},
];
export default class OnboardingFileLabelRemediation extends LightningElement {
error;
columns = columns;
@wire(getUncategorizedDocuments)
onbAppDocs;
}
Apex Class:
public with sharing class OnboardingReviewDocController1 {
@AuraEnabled(Cacheable = true)
public static List<onb_Onboarding_Application_Document__c> getUncategorizedDocuments() {
return [SELECT Document_Type__c,First_Last_DOB__c,Id,Name,Onboarding_Application_Owner_Name__c,S3_link__c,UBO_ID__c,Verification_Status__c
FROM onb_Onboarding_Application_Document__c
WHERE Document_Type__c != NULL];
}
}