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
Carrlos BoydCarrlos Boyd 

Restrict change of 'Owner' on custom object

I have two custom objects (let's call them Object1 and Object2) whose owners are updated automatically through Process Builder. Since FLS does not let me make the fields 'read-only' since they are standard fields, is there a way to keep users from changing the owner of either object via the [Change] button next to the current owner's name? How would I do that?
Best Answer chosen by Carrlos Boyd
Carrlos BoydCarrlos Boyd
This is what I ended up doing. I hid the standard owner field that has the [Change] button and created a custom field for the owner and put in this code:
IF(Owner:Queue.QueueName = "", (Owner:User.FirstName + " " + Owner:User.LastName), Owner:Queue.QueueName)
So now my custom field shows the owner whether it is a user or a queue and with FLS I made it Read-only.

Thanks for the help!

All Answers

Avishek Nanda 14Avishek Nanda 14
Hey Carlos,

You could have a validation rule on the Custom Object which will restrict users to change the Owner of Record. 

Assuming your Owner Field Name API OwnerId and You are Trying to Retrcict on Profile Level Below is Validation Rule At the same time you want to allow some User to Edit you can add the below.

AND( ISCHANGED( OwnerId ),OR( $Profile.Name = "XYZ",$Profile.Name = "ABC",$Profile.Name = "DDD" ),NOT(OR( $User.Id ="Id",$User.Id ="id",$User.Id ="id")))

If this helps Mark it as the best answer. 
Carrlos BoydCarrlos Boyd
Am I replacing the "XYZ", "ABC", and/or "DDD" with another value??
Carrlos BoydCarrlos Boyd
I don't want anyone to be able to edit from this field.
Avishek Nanda 14Avishek Nanda 14
Ok then Add the Profile Names AND( ISCHANGED( OwnerId ),OR( $Profile.Name = "XYZ",$Profile.Name = "ABC",$Profile.Name = "DDD" )))

Where XYZ and ABC are your Profile Name of Org. If you add the Profile Name Users associated with the Profile will not be able to edit the Owener id. 
Carrlos BoydCarrlos Boyd
This is what I ended up doing. I hid the standard owner field that has the [Change] button and created a custom field for the owner and put in this code:
IF(Owner:Queue.QueueName = "", (Owner:User.FirstName + " " + Owner:User.LastName), Owner:Queue.QueueName)
So now my custom field shows the owner whether it is a user or a queue and with FLS I made it Read-only.

Thanks for the help!
This was selected as the best answer