{"id":1724,"date":"2016-03-29T05:37:06","date_gmt":"2016-03-29T05:37:06","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=1724"},"modified":"2025-06-23T09:03:55","modified_gmt":"2025-06-23T09:03:55","slug":"resolving-unable-to-lock-row-issue-in-test-class","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/29\/resolving-unable-to-lock-row-issue-in-test-class\/","title":{"rendered":"Resolving Unable to Lock Row Issue in Test Class"},"content":{"rendered":"<p>We had written lot of test classes for one of our products. In fact we were following the best practices for writing test classes, one of them being writing separate class for separate functionality. While running all test classes we were encountering an issue of UNABLE_TO_LOCK_ROW.<\/p>\n<p><strong><strong style=\"color: #000000;\"><span style=\"color: #800000;\"><a style=\"color: #225e9b;\" href=\"https:\/\/www.greytrix.com\/Product\/10108\/Sage-ERP-X3\/GUMU---Salesforce-Integration\" target=\"_blank\" rel=\"noopener\">Real-time, bi-directional, multi-company \u2013 Sage ERP Integration with Salesforce<\/a><\/span><\/strong><\/strong><\/p>\n<p>It seems that multiple test methods were running at the same time (because of random behavior of test methods) and trying to update the same records in custom setting thereby causing this issue. To overcome this issue, we disabled the parallel execution of Test classes\/methods and this solved our issue.<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/03\/Apex-Test-Execution-Options.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-1725 aligncenter\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/03\/Apex-Test-Execution-Options.png\" alt=\"Apex Test Execution Options\" width=\"502\" height=\"303\" \/><\/a><\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0has some unique solutions for Cloud CRM such as Salesforce integration with\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>),\u00a0Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100\u00a0<\/a>and\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at\u00a0<a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>Related Posts<\/strong><\/span><\/p>\n<ul>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/28\/how-to-configure-email-deliverability-settings-for-email-notification\/\" target=\"_blank\" rel=\"noopener\">How to configure Email Deliverability Settings for Email Notification<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/25\/duplicate-data-management-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Duplicate Data Management in Salesforce<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/25\/reorder-criteria-in-process-builder-using-drag-and-drop\/\" target=\"_blank\" rel=\"noopener\">Reorder Criteria in Process Builder using Drag and Drop<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/04\/how-to-get-apex-page-messages-size-and-use-them-in-your-code\/\" target=\"_blank\" rel=\"noopener\">How to get Apex Page Messages size and use them in your code<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/02\/04\/granting-login-access-to-salesforce-admin-or-support\/\" target=\"_blank\" rel=\"noopener\">Granting Login Access to Salesforce Admin or Support<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>We had written lot of test classes for one of our products. In fact we were following the best practices for writing test classes, one of them being writing separate class for separate functionality. While running all test classes we were encountering an issue of UNABLE_TO_LOCK_ROW. Real-time, bi-directional, multi-company \u2013 Sage ERP Integration with Salesforce\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/03\/29\/resolving-unable-to-lock-row-issue-in-test-class\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[255,504],"class_list":["post-1724","post","type-post","status-publish","format-standard","hentry","category-gumu-salesforce","tag-parallel-apex-testing","tag-unable-to-rock-row"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=1724"}],"version-history":[{"count":2,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1724\/revisions"}],"predecessor-version":[{"id":11024,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1724\/revisions\/11024"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=1724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=1724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=1724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}