I'm using lightning-record-edit-form
to create a new Product field. I need to create it's pricebook values along with it. How do I achieve this? I tried nesting record-edit-form but it isn't working.
Here's the code:
<lightning-record-edit-form object-api-name="Product2" onsubmit ={handleSubmit} onsuccess={handleSuccess}>
<lightning-messages></lightning-messages>
<div class="slds-m-around_medium">
<lightning-input-field field-name='Name'></lightning-input-field>
<lightning-input-field field-name='ProductCode'></lightning-input-field>
<lightning-input-field field-name='Description'></lightning-input-field>
<lightning-input-field field-name='Family'></lightning-input-field>
<lightning-record-edit-form object-api-name="PricebookEntry">
<lightning-messages></lightning-messages>
<div class="slds-m-around_medium">
<lightning-input-field field-name='Pricebook2Id'></lightning-input-field>
<lightning-input-field field-name='UnitPrice'></lightning-input-field>
</div>
</lightning-record-edit-form>
<footer class="slds-modal__footer">
<lightning-button label="Cancel" variant="neutral" onclick={closeModal}></lightning-button>
<lightning-button label="Save" variant="brand" type="submit" name="save" ></lightning-button>
</footer>
</div>
</lightning-record-edit-form>