Hi,
when a user selects a contact, the related account should be set in the corresponding account lookup.
Everything works fine, but when i save the record, the contact field value is getting deleted.
Any suggestions?
function setRelatedAccount() { try { var check = Xrm.Page.getAttribute(incident_account).getValue(); if (check != null) { console.log("Account already set!"); } else { var contact_field = Xrm.Page.getAttribute(incident_contact); if (contact_field != null) { var contact_id = Xrm.Page.getAttribute(incident_contact).getValue()[0].id; if (contact_id != null) { contact = Xrm.Page.getAttribute(incident_contact).getValue(); retrieveAccountForContact("ContactSet", contact_id); //get the account for a contact Xrm.Page.getAttribute(incident_tmpaccount).setValue(account); Xrm.Page.getAttribute(incident_tmpcontact).setValue(contact); } } else { console.log("Contact Field not available!"); } } } catch (ex) { console.log(ex); } }
*This post is locked for comments