2

Before starting, I know about DML operations and the order they should be performed in for test cases. Please do not comment on that. These test cases succeed and have been succeeding in partial and production for over 2 years. We recently enabled the Office 365 Outlook Sync Configuration and we started getting test cases failing in production.

first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Case, original object: S2XUserMap: []

This was once an issue in Winter'18 but has (apparently) been fixed.

https://trailblazer.salesforce.com/issues_view?id=a1p3A0000008gVyQAI

I think my next step is to go through all of the test cases and use a user and profile that is not mapped in the Outlook Office 365 Config. These would be used in just the test case execution.

Our current test cases were written by persona/profile so that we would test specific areas that our code needed to run against. We do create users and use System.runAs() for that test.

3
  • were you able to resolve this? I have the same issue, my test case was working perfect, but suddenly it fails only in production. Note: My production instance was migrated to a different server. Commented Sep 12, 2020 at 6:07
  • We have not had any success figuring this issue out. Salesforce support was no help and we think this is a bug in the product (a regression that came back after a fix). Hopefully, someone else will know the fix. The Salesforce developer boards suggested I look into DML issues :(
    – Mayday
    Commented Sep 14, 2020 at 20:15
  • 1
    I did just read this and it might be related: salesforce.stackexchange.com/questions/207913/… They suggest moving all of the non-DML into the testSetup and not in the testMethods themselves
    – Mayday
    Commented Sep 14, 2020 at 20:18

1 Answer 1

1

According to what you mention it seems is directly related with a Known Issue regarding Lightning Sync and apparently is not going to be addressed.

Running a test class on Lightning Sync enabled Production Orgs will generate the below error for some Apex Test classes; "MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Account, original object: S2XUserMap: []"

https://trailblazer.salesforce.com/issues_view?id=a1p4V0000003we4QAA

1
  • 1
    Our workaround was to add the user that does the automated testing to not be part of the outlook configuration. This allowed tests from gearset to execute and report that they are working as intended.
    – Mayday
    Commented Jun 3, 2021 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .