0

Is there a way to remove all subscribes from a list and every list their in. I know this can be done in the UI. looking at the API but not sure how to delete the all subscribers from all list not just the one in question.

Any help appreciated Pete

-1

I am not familiar of how the subscribers are stored and how are they linked to a certain list so I will make the following assumtions:

Considering all the Subscriber information is in the Subscriber__c SObject, and all the list information is int the List__c SObject, where the List__c is the master detail object in the List -> Subscriber relationship called Subscribers.

Then I would perfrom the following queries to get all the Subscribers which are related to all the lists and then delete them.

Set<Id> subscriberIds = new Set<ID>();
List<List__c> alllists= new List<List__c>([Select id, (Select id from Subscribers) from List__c]);

for(List_c l: alllists)
{
   for(Subscriber__c s : l.Subscribers)
  {

   subscriberids.add(s.id);
  }
}

List<Subscriber__c> allrelatedsubscribers = new List<Subscriber__c>([Select id from Subscriber__c where id in: subscriberids)]


delete allrelatedsubscribers;

This code should give you a good starting point in understanding what you have to do in order to achieve your desired functionality.

  • This is a SF Marketing Cloud question, not a Sales Cloud question. – Adam Spriggs Apr 21 '16 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.