• Shekhar G
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all, I'm getting this error can someone help me with this here is my code:
 
I have deployed this into my org; but in Lightning page it is throwing error the moment when enter value in the field.
-----------------------------
<template>
   
    <lightning-card>
        <lightning-layout>
            <lightning-layout-item size="12" padding="around-samll">
                <lightning-input type ='text' label="Account Name" onchange={accname}></lightning-input> 
                <lightning-input type ='text' label="Account Number" onchange={accnumber}></lightning-input>
                    <lightning-input type ='text' label="Site" onchange={accsite}></lightning-input>
            </lightning-layout-item>
            <lightning-layout-item >
                <lightning-button variant="Brand" title="save" label="click to save" onclick={save}></lightning-button>
            </lightning-layout-item>
        </lightning-layout>
    </lightning-card>
</template> 
 
----------------------------------------
import { LightningElement } from 'lwc';
import creatingAcnt from "@salesforce/apex/AcntInsertLwc.creatingAcnt";
 
export default class Accountinsert extends LightningElement {
    accname;
    accnumber;
    accsite;
    accountId;
    accname(event){
        this.accname = event.target.value;
     }
    accnumber(event){
        this.accnumber = event.target.value;
     }
    accsite(event){
        this.accsite = event.target.value;
    }
    save(){
        creatingAcnt(
            {acntName : this.accname,
              acntNumber : this.accnumber,
              acntSite:this.accsite
             }
        ).then(result=>{
            console.log(result);
            console.log(JSON.stringify(result));
           this.accountId= 'this account has been inserted succesfully'+result.Id;
        }).catch(error=>{'unable to insert record'});
 
    }
}
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

User-added image
Hi all, I'm getting this error can someone help me with this here is my code:
 
I have deployed this into my org; but in Lightning page it is throwing error the moment when enter value in the field.
-----------------------------
<template>
   
    <lightning-card>
        <lightning-layout>
            <lightning-layout-item size="12" padding="around-samll">
                <lightning-input type ='text' label="Account Name" onchange={accname}></lightning-input> 
                <lightning-input type ='text' label="Account Number" onchange={accnumber}></lightning-input>
                    <lightning-input type ='text' label="Site" onchange={accsite}></lightning-input>
            </lightning-layout-item>
            <lightning-layout-item >
                <lightning-button variant="Brand" title="save" label="click to save" onclick={save}></lightning-button>
            </lightning-layout-item>
        </lightning-layout>
    </lightning-card>
</template> 
 
----------------------------------------
import { LightningElement } from 'lwc';
import creatingAcnt from "@salesforce/apex/AcntInsertLwc.creatingAcnt";
 
export default class Accountinsert extends LightningElement {
    accname;
    accnumber;
    accsite;
    accountId;
    accname(event){
        this.accname = event.target.value;
     }
    accnumber(event){
        this.accnumber = event.target.value;
     }
    accsite(event){
        this.accsite = event.target.value;
    }
    save(){
        creatingAcnt(
            {acntName : this.accname,
              acntNumber : this.accnumber,
              acntSite:this.accsite
             }
        ).then(result=>{
            console.log(result);
            console.log(JSON.stringify(result));
           this.accountId= 'this account has been inserted succesfully'+result.Id;
        }).catch(error=>{'unable to insert record'});
 
    }
}
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

User-added image