You need to sign in to do that
Don't have an account?
OnDem Dev
Update User Object
Hi All
While i am trying to update ManagerId in a User Object , it neither throwing any exception nor updating it.
If i am executing the same update statement through System Log it is getting updated , but the same code in
an apex class is not working, Can anyone suggest what exactly might be the reason.
Thanks in Advance
If it is from Apex Code, you need to make sure that you are using the update dml statement. Why not post a bit of the code and that should tell the story.
Cheers
try{
update user;
}catch(DmlException dme){
//return 'From exception '+user.ManagerId+dme;
}
with the following message.
Update failed:First exception on row 0 with id ; first error: MIXED_DML_OPERATION on setup object is not permitted after you have updated a non-setup object : User[Id]
The error is:
Apex trigger MaintCurrentML caused an unexpected exception, contact your administrator: MaintCurrentML: execution of AfterUpdate
caused by: System.DmlException: Update failed. First exception on row 0 with id 00550000000mh92AAA; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object: User: [Id]: Trigger.MaintCurrentML: line 20, column 5
Thanks.
MyGodItsCold wrote:
Was this ever solved? I have a trigger that runs after update & insert on a custom object. Along the way, I attempt to update the current user's User record. Is this not possible?
The error is:
Apex trigger MaintCurrentML caused an unexpected exception, contact your administrator: MaintCurrentML: execution of AfterUpdate
caused by: System.DmlException: Update failed. First exception on row 0 with id 00550000000mh92AAA; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object: User: [Id]: Trigger.MaintCurrentML: line 20, column 5
Thanks.
Were u able to get any solution for your problem? I am running into exactly same issue of Updating User when any Custom Object record is Updated or added.