If you are trying to do the UPSERT operation on the User object, for example:
1 2 3 4 5 |
User theUser = new User(); ... theUser.FederationIdentifier = 'FederationIdentifier'; upsert theUser FederationIdentifier; |
you will get error:
1 |
DML not allowed on User |
Workaround
The workaround for this case is use the Database object:
1 2 3 4 5 |
User theUser = new User(); ... theUser.FederationIdentifier = 'FederationIdentifier'; Database.upsert(theUser, User.Fields.FederationIdentifier, true); |
…and now you can happily use the upsert operation on the User object :)