Mautic Community Forums

Deleting Leads in Bulk

Hi folks I hope this message finds you all doing well.



I am unable to find the place in Mautic where leads can be deleted in bulk. Can someone please point me in the right direction?



I searched in this forum and in Google with no luck. I found commets on github that the feature was rolled out though. Can someone point me in the right direction please?



I am on Mautic V 1.1.3



Thanks a ton for the help. I am enjoying very much using Mautic



Regards,

Leo

Hi folks I hope this message finds you all doing well.

I am unable to find the place in Mautic where leads can be deleted in bulk. Can someone please point me in the right direction?

I searched in this forum and in Google with no luck. I found commets on github that the feature was rolled out though. Can someone point me in the right direction please?

I am on Mautic V 1.1.3

Thanks a ton for the help. I am enjoying very much using Mautic

Regards,
Leo

There is a checkbox in the Lead manager. The first one will select all the leads in currently visible table. Then there is a orange delete button above the table which will delete all selected leads. You can change the rows in the table up to 100 rows if you want to delete in bigger chunks.

Just one thing here, when I try to delete 100 at the time, nothing happens, apparently just refreshes the “selection”, i have a question, is there a way where we can delete more than 100?

This happened to me, I added 5k leads to a list, and I thought that when a “Lead list” is deleted all the leads inside the list would be deleted also, but that is not the case(I guess the “lead list” is only a category internally and not a subfolder)

I need to get rid off all the leads and upload them again, as now only 50 at the time i can delete…

Thank you for your great support!!

In case you would like to delete a higher number of leads than 100 you can access you SQL database under (youhostID)_mautic you will find “leads” and there you will be able to process any action to your data.

Cheers!

I am having the exact same problem.
When selecting leads in bulk, by selecting them all, then clicking the orange button to ‘delete the selected’ leads it thinks about it, stops, then on page refresh the leads are all still there.

The only way I can delete leads is individually, via the litte drop down next to each individual lead.
This is painstaking when I have many leads to delete.

So it appears that the bulk lead deletion isnt working for me.

Hi,

In MySQL TRUNCATE tableName;

This will reset the counter to 1 also but you should contact the Mautic developers as I notice in my other posts that the leads table is linked to other tables ie lead.donotcontact for example.

Hi,

This worked for me however I have not set up points etc yet and a fairly new instance.

[code]
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE leads;
SET FOREIGN_KEY_CHECKS = 1;

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE do_not_contact;
SET FOREIGN_KEY_CHECKS = 1;

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE lead_list_leads;
SET FOREIGN_KEY_CHECKS = 1;[/code]

Hey there,

If you need a simple and quite clean solution, here’s a small JS script I used to delete 30k+ contacts. Just paste in your browser’s console and run it :


// These constants were defined according to the performance of my server.
// You can tweak them, particularily in case actions are triggered before the previous one has ended.
const waitForTableData = 3000 // how long to wait for the table data to be refreshed.
const waitForCheckboxes = 3000 // how long to wait for the checkboxes to be clicked.
const waitForModal = 3000 // how long to wait for the modal to appear
const interval = 30000 // The interval between two scripts run.

// Define a callback to delete leads
const deleteLeads = () => { 
	// Hack Mautic limit of 100 rows per page. When I set 500 rows it's buggy...
  	Mautic.limitTableData('lead',300,'list','.page-list', '/s/contacts'); 
	setTimeout(() => {
		// Click the headers checkbox to trigger checking all rows.
		jQuery('#customcheckbox-one0').click()

		setTimeout(() => {
			// Click the batchDelete button.
			jQuery('a[href="/s/contacts/batchDelete"]').click()
			setTimeout(() => {
				// Click the modal's delete button.
				jQuery('.modal[aria-hidden="false"] .btn-danger').click()
			}, waitForModal)
		}, waitForCheckboxes)
	}, waitForTableData)
}

// First trigger
deleteLeads()

// And run
setInterval(() => {
	deleteLeads()
}, interval)

Just leave your window open so you can see if it’s working properly. In the end, you might be left with pending contacts that are locked by someone, just delete them by hand if there are not many.

Cheers :slight_smile: