While Marketing Cloud includes system data views for retrieving Marketing Cloud subscriber and Journey data, there isn’t a corresponding data view for Contacts. And you might have Contacts that have been imported to the All Contacts list and no longer exist in a Data Extension. In this episode, I explain how to easily create a filtered list of Contacts in Salesforce Marketing Cloud for deletion.
Hello and welcome back to mcChat. In this episode, we’ll look at how to retrieve and delete Contacts in Salesforce Marketing Cloud.
While Marketing Cloud includes system data views for retrieving Marketing Cloud subscriber and Journey data, there isn’t a corresponding data view for Contacts. And there are several scenarios when you would want to retrieve a filtered list of records from your All Contacts list, in order to meet data compliance regulations, or to ensure that you’re within your contact count determination from an account billing perspective.
If you have a list or Data Extension containing records to be deleted, then you can simply initiate the deletion process from the All Contacts page in Contact Builder. But you may have Contacts that have been imported to the All Contacts list and no longer exist in a Data Extension.
Now, here’s a great tip to create a filtered list of Contacts and easily delete them. From the All Contacts page in Contact Builder, click on the Mobile Lists tab. Next, click the ‘Create Mobile List’ button and then the ‘Filtered List’ radio button and click OK. Choose ‘All Contacts’ then click ‘Select’.
Now you can build a filter criteria based on Attributes in your Contact model. In this scenario, I want to delete all Salesforce Leads that were added to a sandbox business unit. I’ll use the System Data Attribute Group to filter all records that begin with ‘00Q’ (which is the prefix used for Salesforce Leads) and also define the corresponding MID of the business unit. I’ll click ‘Save As Filter’, assign a name and click ‘Save’.
If I return to the All Contacts page in Contact Builder and choose to delete Contacts from a List, I can choose the list that I created.
Alternatively, you can automate deletion of records in your filtered list at a regular interval, by creating a scheduled automation with a Refresh Mobile Filtered List Activity (to refresh the Mobile list you created) and a Script Activity that uses the Marketing Cloud REST API to initiate deletion of Contacts. You just need to use the External Key of your list as the list key value in the REST API payload. You can download a copy of my SSJS script from the following link: bit.ly/delete-contacts
Well, thanks for watching and please visit mc.chat for more tips in working with Salesforce Marketing Cloud. See you next time!