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
Parmeshwar Bhore 1010011Parmeshwar Bhore 1010011 

Stop users from updating their own profiles?

I have the requirement to disable  users access (users within a custom Profile) from being able to update their own profile .
For that have to write a trigger to restrict the user to access/not update his own profile.
AnudeepAnudeep (Salesforce Developers) 
Found this code on the forums
 
trigger PreventUserDetailUpdate on User (after update)
{
  Set<id> updatedUsers = Trigger.newMap.keyset();
  Id currentUserId = UserInfo.getUserID();
  if(updatedUsers.contains(currentUserId))
    {
     Trigger.newMap.get(currentUserId).addError('User Not allowed to update their own details');
    }
}

Let me know if this helps
 
Mayur Gore 10Mayur Gore 10

You can also do it from Administrative Permissions on profile.

Shivanath explained it.

https://developer.salesforce.com/forums/?id=906F00000008ntiIAA