Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mixed-dml]

The tag has no usage guidance.

1
vote
1answer
36 views

Just-in-Time Provisioning for Communities Mixed DML Error

We are trying to implement Just-in-Time Provisioning for Communities using custom handler class. There are 3 scenarios When Contact with the provided email (Federation ID) exist in salesforce and ...
4
votes
1answer
53 views

Apex method to find out if SObject is a setup object

Regular SObjects and Setup Objects can't be mixed in DML otherwise you'll experience a Mixed Dml Exception. How can Apex code find out if a given SObjectType is such a setup object? System.assert(...
0
votes
1answer
67 views

Mixed_DML_Operation for one User Update method, but not another. Unclear why

I have a Contact Trigger Handler that, after update, checks to see if some fields (Email or Team) were changed, and if they were, it updates the fields on the Contact's Community User record. These ...
6
votes
0answers
132 views

Why inserting a user object and making callout in a test throws CalloutException in Production?

I stumbled upon strange behavior when executing tests on deployment to production organization. In the test, I first insert a User object, some other objects and then as the last one, a CampaignMember ...
1
vote
1answer
525 views

Is a single APEX test case considered a transaction?

I'm getting DML errors when trying to test some triggers: This error occurred: MIXED_DML_OPERATION: DML operation on setup object is not permitted after you have updated a non-setup object (or ...
2
votes
2answers
411 views

Sudden MIXED_DML_OPERATION errors without code changes

So I have 3 orgs that are basically all on the same codebase. On the production org (the one that gets changed the least) some of the tests are suddenly failing - all with the same error message: ...
1
vote
1answer
92 views

Mixed DML conflict in unit test involving two queueable jobs

I have a complex Apex trigger that calls two separate queueable jobs - one job inserts Permission Set Assignments, and another job creates and deletes ContactShare records. I am positive that neither ...