2

I am creating a lightning-record-form component to display records from Account Object: This is the js file:

import { LightningElement } from 'lwc';
import Account_Name from '@Salesforce/schema/Account.Name';
import Account_Type from '@Salesforce/schema/Account.Type';
import Account_Industry from '@Salesforce/schema/Account.Industry';

export default class AccountCreateSampleComp extends LightningElement {
    objectApiName='Account';
    fieldList=[Account_Name,Account_Type,Account_Industry];
    handleAccountCreate(event){
    }
}

This is the template/html file:

<template>
    <lightning-record-form object-api-name={objectApiName} fields={fieldList} onsuccess={handleAccountCreate}></lightning-record-form>
</template>

I have attached the screenshot of the message received when I try to deployenter image description here

2
  • what is the exception message? Do you any screenshot? Can you add these details to the question? Commented Jan 18, 2021 at 7:45
  • @sanketkumar I have attached the snip of the msg received Commented Jan 18, 2021 at 7:52

1 Answer 1

3

The problem is you have written S capital in salesforce while importing the fields in your JS file.

What you have is:-

import NAME_FIELD from '@Salesforce/schema/Account.Name';

where as the correct import statement is :-

import NAME_FIELD from '@salesforce/schema/Account.Name';
2
  • That works, thanks a lot! Commented Jan 18, 2021 at 8:48
  • @paritoshparimal please upvote this answer and mark it as the best answer in order to reward sanket for his effort in helping you out.
    – Phil W
    Commented Jan 18, 2021 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .