+ Start a Discussion

what is setup objects and non setup objects can any one explain clearly




you can diffrentiate your setup and nonsetup object

Action chaining is a technique to handle the infamous "MIXED_DML_OPERATION, DML operation on setup object is not permitted Error" problem.
You may not know it but there are two types of objects that you can interact with on the platform. One is "setup" object and the other is a "non-setup" object. A "setup" object is one that must be edited from the setup or builder area of the platform. These object include the User object, Ogranization object, Email templates and so on.
See this article for details DML operations of a non-setup sObject and a setup sObject



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. ?


Thanks for ur valuable infrmation

Setup objects are those which interacts with metadata like User, Profile, Layout etc. All other object (Standard and Custom) are non setup object. 


One important note is that we cannot perform DMLs on setup and non setup objects in same transaction. Workaround is that you need to use asynchronous requests (@future) or use batch as it runs in its own system context.

In test class you can use Sytem.RunAs with two different users to separate out transactions for setup and non setup objects. 

Hope this helps.