text: import { LightningElement } from 'lwc';
  import { ShowToastEvent } from 'lightning/platformShowToastEvent';
  import { createRecord } from 'lightning/uiRecordApi';
  import { reduceErrors } from 'c/ldsUtils';
  import ACCOUNT_OBJECT from '@salesforce/schema/Account';
  import NAME_FIELD from '@salesforce/schema/Account.Name';
  
  export default class LdsCreateRecord1 extends LightningElement {
      accountId;
  
      name = '';
  
      handleNameChange(event){
          this.accountId = undefined;
          this.name = event.target.value;
      }
  
      createAccount(){
          const fields = {};
          fields[NAME_FIELD.fieldApiName] = this.name;
          const recordInput = { apiName : ACCOUNT_OBJECT.objectApiName, fields}
          createRecord(recordInput)
                      .then(account => {
                          this.accountId = account.id;
                          this.dispatchEvent(
                              new ShowToastEvent({
                                  title: 'Success',
                                  message: 'Account created. Account Id: '+this.accountId,
                                  variant: 'success',
                              }),
                          );
                      })
                      .catch(error => {
                          this.dispatchEvent(
                              new ShowToastEvent({
                                  title: 'Error creating record',
                                  message: reduceErrors(error).join(', '),//error.body.message,//error.body.output.fieldErrors,
                                  variant: 'error',
                              }),
                          );
                      });
      }
  }