Guest User

Untitled

a guest
Feb 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. global void execute (Database.BatchableContext BC, List<Contact> scope){
  2. List<Contact> ctlist = [select id, Name, Member_Type__c,CreatedDate from Contact where ID NOT IN (SELECT Contact_Name__c from Preference_Center__c) and Member_type__C =:'RM - Regular Member'];
  3. List<Preferences__c> msi = [select id,Name,Is_deprecated__c from Preferences__c
  4. where Is_deprecated__c = false and (Default_Preference__c = 'Member Only'
  5. or Default_Preference__c = 'Both')];
  6.  
  7. List<Contact> searchResults = new List<Contact>();
  8.  
  9. // Each loop processes 200 items
  10.  
  11. List<Preference_Center__c> pclist = new List<Preference_Center__c>();
  12.  
  13. for(Contact c : ctlist){
  14. for(Preferences__c pf : msi){
  15. Preference_Center__c pc = new Preference_Center__c();
  16. pc.Marketing_Subscription_Item__c = pf.Id;
  17. pc.Contact_Name__c = c.id;
  18. pclist.add(pc);
  19. system.debug('list before loop' +pclist);
  20. }
  21. }
  22. system.debug(pclist);
  23.  
  24.  
  25. }
Add Comment
Please, Sign In to add comment