function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Default Contact Assignment


Does anyone know what are the default rules for assigning an owner to a contact? I'm logged in as a community user and in the background I'm creating a contact through an Apex controller. The code creates the contact but never assigns the user. There is no workflow rule / process builder set for contacts. The newly created contact is created by my community user, but the owner is set to a random admin in my org. This "default owner" is different in different sandboxes of the same org. In one of them it tried to assign an inactive admin and threw an error.

sharathchandra thukkanisharathchandra thukkani
there won't be any default rules for assigning an owner to a contact. You need to check your apex controller code whether you are assiging any user to ownerid other wise any workflows which are doing this. You can track the history field for 'contact owner' field so you can see how the value is changing.
There is nothing set in the controller and there is no workflow doing this. If anything was set, then the same owner should be assigned in all sandboxes (or at least with some common feature, e.g. first owner in the list etc.). The contact owner history tracking is set and that random owner is the first owner being set, nothing changes. Are you telling me that without setting the owner in code or workflow, the process should fail?
Maybe there are some other hidden settings that I'm missing.
sharathchandra thukkanisharathchandra thukkani
the running user of the apex code will be set as the owner of the contact. there wont be any hidden setting as per my knowledge.
Hmmm, I'm running it as a community user (not admin). The Created By field is set correctly to my user, but the Owner is someone else, completely random (not even my own admin user).