All Questions
19 questions
0
votes
1
answer
51
views
DMLEXCEPTION NOT BEING CAUGHT
I HAVE WRITTEN THE BELOW CODE BUT IT IS NOT THROWING THE MIXEDDMLEXCEPTION AND I DON'T UNDERSTAND WHY.
public class April22Task2 {
public static void createUserAndAccount()
{
//...
1
vote
1
answer
446
views
Mixed DML occurring even in Finalizer in Queueable
We have a queueable framework where we have an object AsyncRequest__c
Fields Are : ApexClassName__c, Content__c, AttachmentAvailable__c, Status__c etc
So whenever someone wants to enqueue a job they ...
0
votes
2
answers
936
views
HTTP Callout after async DML
I'm trying to do HTTP callout after DML in future method, but I'm getting System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.
What I'm missing? Is ...
0
votes
1
answer
271
views
Facing Mixed DML operation for apex class
I have written a scheduler for deactivating salesforce users who doesn't logged in for last 90 days. The code is working as expected if I remove exception logging into a salesforce object at line #14. ...
1
vote
1
answer
777
views
DmlException Creating CMS Library/Folders
I have some Apex code written to create a new Account, and then create a new Library (ContentWorkspace) and new Folder (ContentFolder) within that Library to house assets for that Account. It appears ...
0
votes
1
answer
587
views
Getting mixed DML even in two standard objects "GroupMember" and "ContactShare"
Scenario -> Creation Contact share record and in the same transaction creating GroupMembers for one of groups related to custom object.
Throws -> Insert failed. First exception on row 0; first ...
0
votes
1
answer
3k
views
Upsert DML Operation
Consider the below code. I thought the way upsert DML works is that if it sees that there is a new record with matching key (here in this case there is already an account with Name = Acme and ...
0
votes
1
answer
308
views
How to avoid MIXED dml Exception in update operation? [closed]
I got System.DmlException in update operation. Can anyone please check the below code and help me to resolve the exception.
I have tried to solve it for the last two days but I couldn't find a ...
1
vote
1
answer
532
views
MIXED_DML_OPERATION : Can not insert a user record from account trigger even when User Role is null
I am trying to create a community user in an after update trigger of account. I am setting the UserRoleId = null but still am getting MIXED_DML_OPERATION exception. As per documentation:
You can ...
1
vote
1
answer
141
views
Is there a way to know if a setup object has been updated in the current transaction?
We have a custom error logging framework built that currently inserts records to a custom Error Log object. We also have a lot of (chained) Queueables in use because have to update some setup objects -...
0
votes
0
answers
129
views
Mixed DML causing test classes to fail to to Process builder
I have a Test class which was working fine but after a new process builder was created on user object to update a custom field created on user object, it started failing. In my test class code I am ...
6
votes
1
answer
804
views
Does MIXED_DML_OPERATION behave differently in test methods depending on how you run them: Test Execution vs. Deployments?
We typically validate our source control nightly and run all tests. This is essentially a validate only deployment running all tests against production. All tests pass.
However, if we were to run ...
1
vote
1
answer
1k
views
You have uncommitted work pending. Please commit or rollback before calling out even if we put DML in future method
I know as per documentation, we cannot perform DML and then callouts from apex class.
In my scenario, I have a callout then I am performing a DML which is placed inside a future method and again ...
1
vote
1
answer
522
views
Update email address and profile on SandboxPostCopy MIXED DML OPERATION error
I've been trying to update user emails and profiles after a sandbox is created and using the SandboxPostCopy interface. However I keep running into the below error:
Update failed. First exception ...
2
votes
1
answer
1k
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 ...
11
votes
2
answers
1k
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(...
1
vote
1
answer
2k
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
2
answers
2k
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
1
answer
282
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 ...