I have an object in which i enter an email and I have an other object in which I want that email to display by default without having to rewrite it (same email for same person) .
as you can see in the picture.
<lightning-input-field field-name='Candidat__c' onchange={handleCandidatChange} > </lightning-input-field>
<lightning-input-field field-name='Email_de_Candidat__c' value='Candidat__r.Email' onchange={handleEmailChange}> </lightning-input-field>
handleEmailChange(event) {
this.email = event.target.value;
}
Best Answer
Apex Controller
HTML Form
JS Code
onchange event is added on Candidat field and calling handleCandidatChange method. Then it will fetch the details of the selected candidate and updates the email in the "Email de Candidat" field value attribute
Hoping that, this will be helpful!