Contact-to-account association is a relationship update, not a text-field update. This part shows how to let an authorized seller select a different Account for a Contact.
1. Add an Account picker
Add a Combo box named cmbParentAccount and bind it to Accounts. Display the Account name and enable search. Configure the control to return a Dataverse Account record.
2. Initialize the current parent
Set the Combo box default selection using the existing Parent Customer lookup when it represents an Account. Because Parent Customer is polymorphic, verify the record type before assigning it to an Account-only picker.
3. Save the relationship
If(
IsEmpty(cmbParentAccount.SelectedItems),
Notify("Choose an account.", NotificationType.Warning),
IfError(
Patch(
Contacts,
varSelectedContact,
{
'Parent Customer': cmbParentAccount.Selected
}
),
Notify(FirstError.Message, NotificationType.Error),
Notify("Contact account updated.", NotificationType.Success);
Refresh(Contacts)
)
)
The lookup column display name and expected record type are environment-specific. Confirm the generated field name and ensure the selected item is an Account record. If the app uses a form, prefer the generated lookup data card’s Update property instead of replacing it with this illustrative Patch.
4. Confirm the relationship in CRM
- Open the Contact in Dynamics 365 Sales.
- Confirm the Parent Customer field shows the selected Account.
- Open the Account and verify the Contact appears in its related contacts.
- Check that ownership and access remain correct after reassignment.
