Thursday 17 May 2018


MIXED_DML_OPERATION error in Salesforce

You can easily run into this error if you are trying to perform DML on setup and non-setup objects in the same transaction.

Non-Setup objects are standard objects like Account or any custom object.

Setup objects are Group, GroupMember, UserTerritory, Territory, etc.

For example, you cannot insert an account and then insert a user or a group member in a single transaction.

Test methods allow for performing mixed DML operations between the sObjects listed earlier and other sObjects if the code that performs the DML operations is enclosed within 
System.runAs method blocks. This enables you, for example, to create a user with a role and other sObjects in the same test.


 How to turn off Email Notifications in Salesforce?

The Email Notification can be turned off or the level can be changed using the below steps

1.       From Setup, click Email Administration --> Deliverability.
2.       Set the Access Level.

No access: Prevents all outbound email to and from users.
System email only: Allows only automatically generated emails, such as new user and password reset emails.
All email: Allows all types of outbound email. Default for new, non-sandbox organizations.