{"id":1860,"date":"2016-05-31T07:04:28","date_gmt":"2016-05-31T07:04:28","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=1860"},"modified":"2025-06-10T09:18:57","modified_gmt":"2025-06-10T09:18:57","slug":"mass-deletion-records","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/05\/31\/mass-deletion-records\/","title":{"rendered":"Mass Deletion of Records"},"content":{"rendered":"<p>There are times when we want to perform mass deletion of records on Salesforce object records. We might come across a scenario where we want to perform Mass delete of records on large number of records of particular object which would delete records in bulk. We checked in Salesforce and we found that this functionality is available in Salesforce only for standard Salesforce objects. What if I want this functionality for records of Custom Objects?<\/p>\n<p>If you are aware of Salesforce Apex and Visualforce development knowledge you can use below set of code to get this done. Below is the function for Mass Delete which calls the action and performs deletion of records.<\/p>\n<p>Steps to Mass delete records of a particular object in Salesforce:<\/p>\n<ol>\n<li><strong>Write a Mass Delete extension\/Controller using Apex:<\/strong><\/li>\n<\/ol>\n<p>In below code example, we have created <strong>Mass Delete<\/strong> button for deleting records of <strong>Account<\/strong> object. You can refer this code to do it for your custom object. Create a new Extension to Account object with name \u201cMassDelete\u201d and you can refer the below code.<\/p>\n<p style=\"padding-left: 60px;\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-Delete-controller.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-1869\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-Delete-controller.png\" alt=\"Mass Delete controller\" width=\"836\" height=\"353\" \/><\/a><\/p>\n<ol start=\"2\">\n<li><strong>Create a Visual Force page to display list of records which you wants to Mass Delete:<\/strong><\/li>\n<\/ol>\n<p>Bind the above controller to Visual Force page and use standard controller list which allows you to create Visual force page that can display or act on a set of records along with RecordSetVar which not only indicates that the page uses a list controller, it also indicates the variable name of the record collection. You can set the <strong><em>standardController<\/em><\/strong> to the API name of the object you want to have this functionality for. Eg. If you want it for Contacts make it \u201c<strong><em>standardController=Contacts<\/em><\/strong>\u201d.<\/p>\n<p style=\"padding-left: 60px;\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Massdelete-VF.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1867\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Massdelete-VF.png\" alt=\"Massdelete-VF\" width=\"933\" height=\"92\" \/><\/a><\/p>\n<ol start=\"3\">\n<li><strong>Add the Mass Delete Button on the UI (Tab for the object)<\/strong><\/li>\n<\/ol>\n<ul>\n<li>Go to that particular object selected for example in your case Account.<\/li>\n<li>Click on <strong>Button, Links and Action<\/strong> and create a button as given in below screenshot.<\/li>\n<\/ul>\n<p style=\"padding-left: 60px;\"><a href=\"http:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-delete-button-creation.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"alignnone wp-image-1864 size-full\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-delete-button-creation.png\" alt=\"Mass delete of records button creation\" width=\"1079\" height=\"485\" \/><\/a><\/p>\n<ul>\n<li>Click search layout and go to that object&#8217;s List view. e-g Accounts List View<\/li>\n<li>Now button created appears on Available buttons and we need to add to selected button and click save.<\/li>\n<\/ul>\n<p style=\"padding-left: 60px;\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-delete-button-added-to-search-layout.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1863\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Mass-delete-button-added-to-search-layout.png\" alt=\"Mass-delete-button-added-to-search-layout\" width=\"1080\" height=\"561\" \/><\/a><\/p>\n<ul>\n<li>Finally, the selected button will appear on Object&#8217;s home page by clicking GO.<\/li>\n<\/ul>\n<p>In image below, we have selected two records which get deleted on clicking <strong>Mass Delete<\/strong> button. In similar way, we can delete other records using Mass delete function.<\/p>\n<p style=\"padding-left: 60px;\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Massdelete-selected-records.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1866\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/05\/Massdelete-selected-records.png\" alt=\"Massdelete selected records\" width=\"1266\" height=\"208\" \/><\/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><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2015\/02\/19\/gumu-sage-100-erp-integration-pro-now-on-salesforce-appexchange\/\">GUMU Sage 100 ERP Integration (Pro) now on Salesforce AppExchange<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2015\/07\/28\/synchronize-dropdowns-in-salesforce-using-gumu-sf-sage-100-erp-integration\/\">Synchronize Dropdowns in Salesforce using GUMU SF \u2013 Sage 100 ERP Integration<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/01\/29\/allowrestrict-salesforce-user-access-to-erp-data-with-gumu-security-matrix\/\">Allow\/Restrict Salesforce user access to ERP data with GUMU Security Matrix<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>There are times when we want to perform mass deletion of records on Salesforce object records. We might come across a scenario where we want to perform Mass delete of records on large number of records of particular object which would delete records in bulk. We checked in Salesforce and we found that this functionality\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/05\/31\/mass-deletion-records\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[13,88,230,367],"class_list":["post-1860","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-apex","tag-delete","tag-mass-delete","tag-salesforce"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1860","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=1860"}],"version-history":[{"count":6,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1860\/revisions"}],"predecessor-version":[{"id":10874,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/1860\/revisions\/10874"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=1860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=1860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=1860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}