You need to sign in to do that
Don't have an account?

Is it possible to modify any fields within the User table using Apex?
Hi all,
I've searched for other threads with similar issues, but I couldn't find one with an exact answer. I wrote some Apex code that attempts to update a field within a User record. When I tested my class, just by looking at my debug statements, it seems that the field is getting updated. However, when the trigger is actually fired, I'm getting the following exception:
System.DmlException: Update failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You cannot update a customizable setup entity, except when running tests
So it seems on this particular table, the field can only be updated on a test class but not on my actual trigger.
I read the Apex Doc, and there's a section that mentions that not all SObjects can be updated using Apex but it doesn't specify which SObjects can or cannot be updated.
If anyone can confirm this, I'd appreciate it.
Thanks in advance.
i haven't had a use case come up with the need to modify the user object yet, so i'm unsure if there is a hard limitation on accessing that object in anything but select statements.
Here's where it gets cool though. in the Force.com IDE, and also the sForce Explorer, you can drill into the schema to verify what you're trying to update can in fact be touched. When you drill down to User > Fields > > [field name] > attributes, you should see an update-able flag. It does say that Title and IsActive are updatable, so there's gotta be something else awry here.