Qus:    What is the purpose of system.runAs()?
Oct 06, 2021 02:19 1 Answers Views: 469 NAIDU
Prev Next
Answers (1)
RAMU Oct 07, 2021 00:20
Answer:   By default test class runs in System Mode. If you want to execute a piece of code in a certain user context then we can use system.runAs (UserInstance). For more details refer 2nd question in visualforce category.
To avoid MIXED-DML-OPERATION error we can include DML statements inside of system.runAs(), still the error persists keep DML statements inside of Test.startTest() and Test.stopTest().

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.

Let`s Connect