Mixed DML or Not ?

public class MixedDMLORNOT
{
    public static void main()
    {
        Insert new Account(Name='Hello');
        Insert new Contact(LastName='HelloCon',AccountId='0014000001n2MSVAA2');
        Update new User(Id=[Select Id From User Where IsActive=true AND Profile.Name='System Administrator' LIMIT 1].id);
    }
}

To execute :
MixedDMLORNOT.main();

In the above code even though we are trying to perform DML with Setup & non-Setup, it won't throw any error because there are few rules that are relaxed on the User Object.

Resource : clickHere


Comments

Post a Comment