Hi all,
I've created a flow so that whenever the opportunity owner field is updated, the related contact owner field is also updated to be the same.
I thought it'd be quite simple, which it was, but during testing it keeps throwing the error in the title which says the ownerID field is blank, but it's not. Not on the Opportunity and not on the Contact.
I've googled endlessly and can't find a solution, any help is greatly appreciated!
Hi Charlie,
This error (INVALID_CROSS_REFERENCE_KEY: Owner ID: owner cannot be blank) typically occurs for one of two main reasons when attempting to update Contact ownership from an Opportunity:
1. How is the Flow referencing the Contact? (Primary Suspect)
By default, standard Opportunities do not have a direct lookup to ContactId unless you are using:
- Custom fields (e.g., a custom Primary_Contact__c lookup).
- Opportunity Contact Roles (OpportunityContactRole).
Check your Update Records element:
- If your flow is trying to update records of type Contact using a filter like Id Equals $Record.ContactId (or an empty custom lookup field), that lookup value is resolving to null/blank.
- When Salesforce receives an update request for a Contact where the target record ID or lookup resolution fails/is null, it often misinterprets the payload and throws Owner ID: owner cannot be blank or an INVALID_CROSS_REFERENCE_KEY.
- Fix: Verify how your Opportunity finds the related Contact. If you use Opportunity Contact Roles:
- Add a Get Records element to find the OpportunityContactRole where OpportunityId Equals $Record.Id (and optionally IsPrimary Equals True).
- Add a Decision element to check if a Contact Role was found ({!Get_Contact_Role} Is Null False).
- In your Update Records element, update the Contact where Id Equals {!Get_Contact_Role.ContactId}, setting OwnerId = $Record.OwnerId.
2. Is the New Opportunity Owner an Active User?
- Unlike Accounts, Leads, and Cases, Contacts cannot be owned by Queues—a Contact's OwnerId must always resolve to an active User ID (prefix 005).
- If your Flow is passing a Queue ID, or if the user being assigned is inactive or lacks the necessary license/permissions on the Contact object, Salesforce rejects the assignment with this cross-reference error.
- Ensure you are mapping:
- Field: OwnerId
- Value: {!$Record.OwnerId} (make sure you select the ID itself, not a related field like Owner:User > ContactId).
3. Contact "Private Record" Sharing Restriction
In Salesforce's standard data model, a Contact without an AccountId is considered a private contact and has strict ownership rules:
- If the related Contact is not associated with an Account, changing its owner requires specific permissions and cannot always inherit owners dynamically.
- Ensure the target Contact has an associated AccountId.
Quick Debugging Tip:
Run your flow using the Debug button in Flow Builder with the specific Opportunity record ID where you saw the failure. Look at the right-hand debug panel under the Update Records step—it will show the exact values being passed into OwnerId and Id.
Hope this helps track down the culprit!