I have Three campaigns in sales force. Each campaign has 2000 leads. I want to remove all the leads from campaign at once. But not delete the campaign, Is there a way to mass delete all the campaign members. Sales force only provides with deleting 200 members at once. Would be a great help!

  • You can do this a variety of ways, including the data loader, Apex Code, various Salesforce ETL tools, etc. Only the UI happened to be limited to 200 at a time.
    – sfdcfox
    Dec 22, 2017 at 19:23

1 Answer 1


For less than 10,000 rows, the easiest way would be an execute anonymous script:

delete [select Id from CampaignMember where Campaign.Name in ('Name 1','Name 2','Name 3');

To run this, click on Your Name / Developer Console, and in there, click on Test / Open Execute Anonymous Window..., enter the code, and click the Execute button.

You could also query the records in the data loader, or the Excel Connector, or other tools.

You could even build a Visualforce page or Lightning Component to do this.

  • That worked! Just One question. Can I add a button or action that does the same and then add this code in it ?
    – richie
    Dec 26, 2017 at 14:34
  • @richie yes, you could write a Lighting component, Visualforce page, custom JavaScript button, etc. There's plenty of fine examples on code you could use. I'd probably recommend Visualforce at this point. Try a search like Visualforce Mass delete records.
    – sfdcfox
    Dec 26, 2017 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .