Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return Database.getQueryLocator(query);
- }
- global void execute(Database.BatchableContext bc, List<Benefit__c> scope){
- // process each batch of records
- List<Contact> contacts = new List<Contact>();
- List<Task> TaskList = new List<Task>();
- set<id> conset = New set<id>();
- Map<id,benefit__c> ConMap = new map<id,Benefit__c>();
- for (Benefit__c b : scope) {
- conset.add(b.contact__c);
- ConMap.put(b.contact__c, b);
- b.task_created__c = TRUE;
- }
- system.debug('contact and its benefit------'+ConMap);
- recordsProcessed = conset.size();
- //List<Contact> tempList = new List<Contact>();
- // tempList = [Select Id,OwnerId, firstname from Contact where Id IN:(conset)];
- if(!ConMap.isEmpty())
- {
- for(Benefit__c ben : ConMap.values())
- {
- Task taskObj = new Task();
- taskObj.OwnerId = ConMap.get(ben.contact__c).contact__r.OwnerId;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement