Step 1:- Create Lightning Web Component : createConRelAcc.html
`
`
Step 2:- Create Lightning Web Component : createConRelAcc.js
` import { LightningElement, track } from 'lwc';
import { createRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import accObj from '@salesforce/schema/Account';
import accFld from '@salesforce/schema/Contact.AccountId';
import nameFld from '@salesforce/schema/Account.Name';
import conObj from '@salesforce/schema/Contact';
import conNameFld from '@salesforce/schema/Contact.LastName';
export default class CreateConRelAcc extends LightningElement {
Step 3:- Create Lightning Web Component : createConRelAcc.js-meta.xml
` <?xml version="1.0" encoding="UTF-8"?>
55.0truelightning__AppPagelightning__RecordPagelightning__HomePage`
**[→ Get source code live demo link:-](https://www.w3web.net/create-account-with-contact-in-lwc/)**
In this post we are going to learn about How to Create Account With Contact In LWC – Lightning Web Component Salesforce.
→ Get source code live demo link:-
Step 1:- Create Lightning Web Component : createConRelAcc.html
`
`
Step 2:- Create Lightning Web Component : createConRelAcc.js
` import { LightningElement, track } from 'lwc'; import { createRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import accObj from '@salesforce/schema/Account'; import accFld from '@salesforce/schema/Contact.AccountId'; import nameFld from '@salesforce/schema/Account.Name'; import conObj from '@salesforce/schema/Contact'; import conNameFld from '@salesforce/schema/Contact.LastName';
export default class CreateConRelAcc extends LightningElement {
}`
Step 3:- Create Lightning Web Component : createConRelAcc.js-meta.xml
` <?xml version="1.0" encoding="UTF-8"?>