Loading

Error 'UNABLE_TO_LOCK_ROW' when running test classes

Publiceringsdatum: Apr 23, 2024
Beskrivning
When running multiple test classes where community/portal users are inserted and parallel / Serial execution of tests is enabled results in 'UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record' error.
Lösning

- The behavior is Working as designed.
 

Workaround:
==========

-Use RunAs function instead of creating new users in the test class.
-Please consider running deployments during off-peak hours.
-Temporarily disable the jobs where the portal users are created, before starting the test class validation.
-Avoid parallel execution when running test classes which insert such users, to resolve the error.
 

If error still persists, please reach out to Salesforce support for additional help.

 

Knowledge-artikelnummer

000380602

 
Laddar
Salesforce Help | Article