You need to sign in to do that
Don't have an account?
Mixed DML errors from Site.createexternaluser limiting automation
I have a custom community self registration that runs the site.createexternaluser(user,accountID, password).
I also have a Flow that is triggered off insert of a user and a status field on the user account that initiates a verificataion process.
This flow updates fields on the User record.
When the flow runs after the createexternaluser is intiated, I get an error:
MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: Account
I can't use an @future method for this as the user insert and verification flow must be sequentional as it is a login flow and has user interface implications.
I find it strange that the createexternaluser is obviously exempt from this Mixed DML validation, but any related context is not.
Does anyone know how you can update a user record in the same context on the createexternaluser method without using an @future method?