Questions tagged [mixed-dml]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
28 views

Batch method making callout: uncommitted work pending

My app is an SMS lightning component, so in many situations, I'm doing DML updates AND making a callout. I have avoided the "uncommitted work pending" errors by using @future (callout=true) on all the ...
1
vote
1answer
41 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
58 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
72 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
135 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
595 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
517 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
102 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 ...