function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Madan51Madan51 

Error while creating a new custom object record by using LWC

I created an LWC to create a new record for a standard object, i am able to create  successfully for an account object.But its throwing an error while creating a new record .
Here is the code i wrote :
FOR ACCOUNT OBJECT:
HTML file:--
<template>
   <Lightning-record-form 
        object-api-name={accountobject} 
        fields={fields} 
        onsuccess={handleAccountCreate}>      
   </Lightning-record-form> 
</template>
JS file :--
import { LightningElement } from 'lwc';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import WEBSITE_FIELD from '@salesforce/schema/Account.Website';
export default class CreateNewRecord extends LightningElement {
    accountobject = ACCOUNT_OBJECT;
    fields =[NAME_FIELD , WEBSITE_FIELD];
    handleAccountCreate(){
    }
}
For the above piece of code its working fine.But for the below code for a custom object record creation 
HTML file :--
<template>
    <Lightning-record-form  object-api-name={objectApiName} 
                            fields={fields} 
                            onsuccess={handleSuccess}>
    </Lightning-record-form>
</template>
JS file :--
import { LightningElement ,api } from 'lwc';
import {ShowToastEvent} from 'Lightning/platformShowToastEvent';
import AREA__c_OBJECT from '@salesforce/schema/Area__c';
import NAME_FIELD from '@salesforce/schema/Area__c.Name';
import PINCODE_FIELD from '@salesforce/schema/Area__c.pincode__c';
export default class CustomeObjectRecordCreate extends LightningElement {
    @api objectApiName;
    AreaName = AREA__c_OBJECT;
    fields = [NAME_FIELD , PINCODE_FIELD];
    handleSuccess(event){
        const evt = new ShowToastEvent({
           title:"record created", 
            message:event.detail.NAME_FIELD,
            variant:"success"
        });
            this.dispatchEvent(evt);
    }
}

in the code above "Area " is the name of custome object.and Name and pincode are the fields in custom object.
Plz help me for that.thanks in advance.

 
Madan51Madan51
Sorry ,In the above question i forget to mention the error coming while deploying the LWC from Source to org.
The error i am getting is "Invalid refference Area__c.pincode__c of type SobjectField in file LwcName.js"
here Area (custom object),pincode custom field and LwcName (name of my LWC).
This is the extension for my above question. 
Joy BingJoy Bing
We bring for the best and reliable technical support on your queries related to your Office Setup. After thorough research and analysis, we bring for you easy steps that will help you through the process of Office.com/setup. in case of any query related to our Office Setup reach out to our experts.