7

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.

Image

2

Write trigger on users object and show error if user is not system admin and he is trying to update user record..

  • Yeah that is what I have been doing in the past but was hoping that there would of been a profile permission based solution – BarCotter Apr 25 '14 at 11:17
2

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.

1

Write validation rule on user object

AND(
 OR(
    (ISCHANGED(Email)) )
    && NOT(CONTAINS( $Profile.Name , "System Administrator" ))
)
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"))
)
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.