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
WalidWalid 

Prevent record owner from changing the record "owner" field

Hi there,

This is driving me crazy!

I am new to Salesforce, and I want to know how to prevent a user, say John Smith, who owns a record, say an opportunity, from transfering his record to another user. In other words, I don't want this user to see the link [change] next to the owner name, which is his name.
User-added image
I tried every possible combination without success:
- Field-Level security does not allow me to change to Read-Only
- Page Layout: Read-Only checked and Read-Only unchecked both give the sanme result: [change]  is still visible, 
- Profile permissions, I am using Standard User: the Transfer Record permission is unchked, Modify All Data also unchecked.
- No Permission Set given to t his user

The owner field ALWAYS shows the [change] link next to it, and the user can change the owner field.

Any solution?

Thanks.
 
JeffreyStevensJeffreyStevens
Have you read through this 
https://developer.salesforce.com/forums/?id=906F00000008k2XIAQ

?
RaidanRaidan
I think the trick is to hide the Owner field from the page layout. If you really need to show the Owner, you can create a custom field and copy the value from the original owner field using a Workflow or Process Builder.
Rakesh51Rakesh51
Use Validation rule
WalidWalid
Thanks guys for the tips.

I have 3 possible workarounds:
  1. Validation Rule as mentioned by Rakesh and Jeffrey and this post: https://developer.salesforce.com/forums/?id=906F0000000kAIvIAM - Basicaly, the rule will only allow the Admin (or the user ID that you provide) to change this fields. All other users will get aan error, but they can still see the [change] link.
  2. Create another Layout that gets rid of the field and assign it to the users that should not change the Owner fo the record: https://developer.salesforce.com/forums/?id=906F00000008o35IAA
  3. Raidan idea seems also good if it can be appllied. How do I copy the value of the Owner field to the new custom field? 

Finally, is this behavior special for any Owner field in Salesforce? Like I could not make it Read-Only from the Field Level security. 

Thanks again!

Regards,
Walid 
 
RaidanRaidan
Hi Walid,

To implement the idea you can use Workflow or Process Builder. When the record is created or the owner is changed, then you make a field update to the new custom field (a lookup to User object) with the owner field value. Let me know if you need more details on the implementation.
 
EE
You could also use a formula field, which is a little easier than a WFR or Process Builder (IMO).

My org assigns cases to either a queue or a specified user, depending on the values of certain fields on the case record. To accomodate for this, I used the following formula to create a formula field with text output:

IF( Owner:Queue.QueueName <> "", Owner:Queue.QueueName, Owner:User.FirstName + " " + Owner:User.LastName )

From there, I removed the standard Owner field from the page layout (assigned to all users) and replaced it with my new formula field.

I also had to accommodate for certain users who still need to access the standard Owner field, so I created another page layout (that shows standard Owner field) and assigned it to the designated users.