You need to sign in to do that
Don't have an account?
Dolgoldy
Checking record which is already inserted
want to check records which is already inserted in lwc.datatable.this the code below
// Html file <template> <!-- lightning button for open modal window --> <lightning-button variant="brand" label="Add New Work Order" title="What is Modal/PopUp in LWC?" onclick={openModal} class="slds-float_right"> </lightning-button> // JS code openModal() { // to open modal set isModalOpen tarck value as true this.fetchStandardWorkOrders(); } fetchStandardWorkOrders(){ getStandardWorkOrders({}) .then(res=> { let generalarray = []; let specailtyWO = []; let customNamedWO = []; res.forEach(element => { if(element.Type__c == 'Standard'){ generalarray.push(element); } else if(element.Type__c == 'Specialty'){ specailtyWO.push(element); } else if(element.Type__c == 'Custom Named'){ customNamedWO.push(element); } }); this.generalarray = generalarray; this.customNamedWO = customNamedWO; this.specailtyWO = specailtyWO; this.isModalOpen = true; }) .catch(err=> { console.log(err); }) }
You need to check by workOrderId or Name in apex class and return to LWC
when you try to Insert existing workorder in LWC UI then your request will send to apex controler and this controller will check by SOQL
if record is already exist ot not
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh