Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. return Database.getQueryLocator(query);
  2.  
  3. }
  4.  
  5. global void execute(Database.BatchableContext bc, List<Benefit__c> scope){
  6. // process each batch of records
  7.  
  8. List<Contact> contacts = new List<Contact>();
  9. List<Task> TaskList = new List<Task>();
  10. set<id> conset = New set<id>();
  11. Map<id,benefit__c> ConMap = new map<id,Benefit__c>();
  12. for (Benefit__c b : scope) {
  13. conset.add(b.contact__c);
  14. ConMap.put(b.contact__c, b);
  15. b.task_created__c = TRUE;
  16. }
  17. system.debug('contact and its benefit------'+ConMap);
  18. recordsProcessed = conset.size();
  19. //List<Contact> tempList = new List<Contact>();
  20. // tempList = [Select Id,OwnerId, firstname from Contact where Id IN:(conset)];
  21. if(!ConMap.isEmpty())
  22. {
  23. for(Benefit__c ben : ConMap.values())
  24. {
  25. Task taskObj = new Task();
  26. taskObj.OwnerId = ConMap.get(ben.contact__c).contact__r.OwnerId;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement