Avoid Using Server side Call(Apex Class) using lightning/uiRecordApi . For Toast in LWC use lightning/platformShowToastEvent. Example : import OBJECT from '@salesforce/schema/ObjectAPIName'; import NAME_FIELD from '@salesforce/schema/ObjectAPIName.FieldAPIName'; ObjectAPIName can be Account/Contact/CustomObject__c FieldAPIName can be Name (FieldAPIName). Lwc_DemoComponent.js: import { LightningElement , track } from 'lwc' ; import { createRecord } from 'lightning/uiRecordApi' ; import { ShowToastEvent } from 'lightning/platformShowToastEvent' ; import OBJECT from '@salesforce/schema/ObjectAPIName' ; import NAME_FIELD from '@salesforce/schema/ObjectAPIName.FieldAPIName' ; export default class Lwc_DemoComponent extends LightningElement { isActive = true ; @ track groupId ; name = '' ; handleNameChange ( event ) { this . groupId = undefined ;
Everything about Salesforce