Skip to content

Instantly share code, notes, and snippets.

@waltonzt
Created February 6, 2018 15:27
Show Gist options
  • Select an option

  • Save waltonzt/fe461c43f58c26404bb0e33c49dc61f9 to your computer and use it in GitHub Desktop.

Select an option

Save waltonzt/fe461c43f58c26404bb0e33c49dc61f9 to your computer and use it in GitHub Desktop.
List<Contact> cont = new List<Contact>();
Map<String, inscor__Customer_Quote__c> cqMap = new Map<String, inscor__Customer_Quote__c>();
for (inscor__Customer_Quote__c cq : [SELECT Id, inscor__Contact__c FROM inscor__Customer_Quote__c]) {
cqMap.put(cq.inscor__Contact__c, cq);
}
for (Contact c : [SELECT Id FROM Contact WHERE inscor__External_Reference_ID__c = null]) {
if (!cqMap.containsKey(c.Id)) {
cont.add(c);
}
}
delete cont;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment