[SalesForce] Why I can’t change OwnerId to null or empty

I'm trying via Bulk API update Opportunity field OwnerId to empty (or null) value. But it impossible.
If I set a "" (empty value string) to field OwnerId – update has success but nothing to change.
If I set "null" to this field – update falling with INVALID_CROSS_REFERENCE_KEY. Heed help, thx!

Best Answer

All Records in Salesforce must have an Owner which is either a User or a Queue, if you try and set OwnerId to Null or blank "", this will always fail as the field is mandatory therefore Null is not an acceptable value.

As the Salesforce security model for data is built around record ownership this is correct behaviour as it will mean that any relevant users are able to access this Opportunity. The record owner will be important for the record visibility due to the role hierarchy, OWD and sharing rules so it would be a problem to make have a null or empty value.

I am not sure I understand what business case there is for not having an Owner for a record? Even if it is not an individual then a queue should be used for the record to be picked up from for update. Please explain what you are trying to achieve then you will be able to get an answer that helps you.

Related Topic