Showing results for 
Search instead for 
Did you mean: 

Delete Accounts without Opportunities


Hello all, is there a way to query the number of Opportunities an Account has and then delete the Account if the number is 0 (among other criteria)? We are wanting to automatically delete dormant Accounts using dtv.


Validity Team Member
Validity Team Member

Hi @tandersontph, this a great use case - If you don't already have a field with the number of Opportunities listed on the Account or a process in place to do so, you will first want to create a scenario using the Record Count action in the Modify module. You can choose which child object you would like to count & where you want that total to be placed on the Account object as shown below, keeping in mind that you will need a field created to hold that value:


Once you've totalled the amount of Opportunites on the Account, you can then use the Delete module to query and delete any Accounts you see fit. Once the Delete module is opened, you can click the Source dropdown and actually choose your Salesforce environment as a source. Just be sure to use the Select Subset/Filter Records button to query only those records with 0 opportunities or you might have a mess on your hands. Luckily the Delete module lets you preview first! Additionally I recommend using Soft Delete in case you need to Undelete any records from your recycle bin after the fact.


Let me know what you think!



Jonathan Greenip
Customer Success Manager