1

I have js file in the lwc that keeps giving me the Error Invalid reference, but it still works 100%, i just can't make new changes. I would like to add a validation that there has to be something in the notes field before being able to click the button "took place" but i can't work on the js file.

 import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import markTookPlace from '@salesforce/apex/TreatmentEventsController.markTookPlace'; import unmarkTookPlace from '@salesforce/apex/TreatmentEventsController.unmarkTookPlace'; import TREATMENT_EVENT_OBJECT from '@salesforce/schema/Treatment_Event__c'; import DOCTOR_FIELD from '@salesforce/schema/Treatment_Event__c.Doctor__c'; import NOTES_FIELD from '@salesforce/schema/Treatment_Event__c.Notes__c'; import GUIDE_FIELD from '@salesforce/schema/Treatment_Event__c.Guide__c'; export default class TreatmentEventInfo extends LightningElement { @api event; @track treatmentEventObject = TREATMENT_EVENT_OBJECT; @track doctorField = DOCTOR_FIELD; @track notesField = NOTES_FIELD; @track guideField = GUIDE_FIELD; @track showUpdateNotesButton = false; get upcomingEvent() { return new Date(this.event.startDate) > new Date(); } toggleSection(event) { const eventId = event.target.dataset.eventId; this.dispatchEvent( new CustomEvent('togglesection', { detail: eventId, }), ); } handleDoctorChange() { this.template.querySelector('lightning-record-edit-form').submit(); } handleNotesChange() { this.showUpdateNotesButton = true; } handleSuccessDoctorChange() { this.dispatchEvent(new CustomEvent('doctorchange', {})); } handleSuccessNotesChange() { this.showUpdateNotesButton = false; } handleTookPlace() { markTookPlace({ eventId: this.event.id }) .catch((error) => { this.dispatchEvent( new ShowToastEvent({ title: 'An error occured', message: error.body.message, variant: 'error', }), ); }) .finally(() => this.dispatchEvent(new CustomEvent('statuschanged', {}))); } handleUntookPlace() { unmarkTookPlace({ eventId: this.event.id }) .catch((error) => { this.dispatchEvent( new ShowToastEvent({ title: 'An error occured', message: error.body.message, variant: 'error', }), ); }) .finally(() => this.dispatchEvent(new CustomEvent('statuschanged', {}))); } } 

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.