I have a record edit form on which I'm binding my record id. When I pass record ID as hardcoded form then the lightning record edit form gets loaded but when I'm passing that ID dynamically record edit form does not load.Below is the code :
.HTML
<template if:false={viewForm}>
<lightning-record-edit-form record-id={closeoutId} object-api-name="Contract_Close_Out__c">
<lightning-output-field field-name="Contract_Type__c">
</lightning-output-field>
<lightning-input-field field-name="Anticipated_Close_out_date__c">
</lightning-input-field>
<lightning-input-field field-name="Evidence_of_physical_completion__c">
</lightning-input-field>
<lightning-input-field field-name="Contractual_Warranty__c">
</lightning-input-field>
<lightning-button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update">
</lightning-button>
</lightning-record-edit-form>
</template>
.JS
onEditHandler(){
getCloseOutId({
id : this.recordId
}).then(result => {
this.closeoutId = 'a0z1G00000BOVxvQAH'; //Record edit form gets loaded
this.closeoutId = result.map((item) => (item.Id)); //Record edit form does not get loaded,although in console I can see the ID printed.
console.log('this.closeoutId : '+this.closeoutId);
this.viewForm = false;
})
}
ID
printed in console.