HTML
<template>
<lightning-card>
<lightning-record-edit-form object-api-name="Opportunity"
onsuccess={handleSuccess}>
<lightning-input-field field-name='AccountId'></lightning-input-field>
<lightning-input-field field-name='Name'></lightning-input-field>
<lightning-input-field field-name='CloseDate'></lightning-input-field>
<lightning-input-field field-name='StageName'></lightning-input-field>
<lightning-button class="slds-m-top_small" type="submit" label="Create Opportunity">
</lightning-button>
</lightning-record-edit-form>
</lightning-card>
<div style="color:green;">{successMessage}</div>
</template>
JavaScript
import { LightningElement} from 'lwc';
export default class CreateOpp extends LightningElement {
successMessage;
oppName;
handleSuccess(event) {
this.successMessage ='New opportunity has been created. + ID: ' + event.detail.id;
this.oppName=event.detail.id;
}
}
Video
Video does not exists.