Is there any way to restrict a user from updating their user details (first name, last name, email etc...)? Revoking CRUD access to the user object does not stop this.
Currently users can navigate to their profile by clicking on their name and then "My Profile". On this screen they are able to change their user details.
Attribution to: BarCotter
Possible Suggestion/Solution #1
Using a Trigger:
A trigger can be added that will fire when the user record is edited. The trigger can then check for any desired criteria and add an error if needed.
Using a Validation Rule:
A validation rule could be added to the User object. The validation below will stop all users except the System Administrators from editing the Email field.
AND(
ISCHANGED(Email),
NOT(CONTAINS( $Profile.Name , "System Administrator"))
)
Attribution to: BarCotter
Possible Suggestion/Solution #2
Write trigger on users object and show error if user is not system admin and he is trying to update user record..
Attribution to: AtulRajguru9
Possible Suggestion/Solution #3
I would just create a custom setting to toggle on/off plus a standard validation rule, I haven't tried it personally, it may not work. But would try that before code.
Attribution to: Michael Gill
Possible Suggestion/Solution #4
Write validation rule on user object
AND(
OR(
(ISCHANGED(Email)) )
&& NOT(CONTAINS( $Profile.Name , "System Administrator" ))
)
Attribution to: user10533
Possible Suggestion/Solution #5
You can use the following Visualforce page to allow user to be routed to User Detail Edit page only if they are System Admin and redirect to User Detail View page if they are not, when a user clicks edit button on User Detail:
The Visualforce page with below code can be used to override Edit action for User
<apex:page standardController="User" action="{!if($Profile.Name='System Administrator',URLFOR('/'&$CurrentPage.parameters.id&'/e', $CurrentPage.parameters.id, [retURL=URLFOR('/'&$CurrentPage.parameters.id&'?noredirect=1&isUserEntityOverride=1')], true), URLFOR('/'&$CurrentPage.parameters.id&'?noredirect=1&isUserEntityOverride=1', $CurrentPage.parameters.id, null, true))}" >
</apex:page>
Attribution to: aditya
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33670