Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. global class UpdateEventScore implements Database.Batchable<sObject> {
  2.  
  3. global Database.QueryLocator start(Database.BatchableContext bc) {
  4. // collect the batches of records or objects to be passed to execute
  5. return Database.getQueryLocator(
  6. 'Select Contact.Account.ID' +
  7. 'from CampaignMember' +
  8. 'WHERE Campaign.StartDate = LAST_N_DAYS:365' +
  9. 'AND status = 'Attended' ORDER BY Campaign.StartDate'
  10. )
  11. }
  12. global void execute(Database.BatchableContext bc, List<P> records){
  13. // process each batch of records
  14. }
  15. global void finish(Database.BatchableContext bc){
  16. // execute any post-processing operations
  17. }
  18. }
  19.  
  20. global class UpdateEventScore implements Database.Batchable<sObject> {
  21.  
  22. global Database.QueryLocator start(Database.BatchableContext bc) {
  23. // collect the batches of records or objects to be passed to execute
  24. return Database.getQueryLocator([
  25. SELECT Id FROM Account WHERE Id IN (
  26. SELECT Account__c
  27. FROM CampaignMember
  28. WHERE Campaign.StartDate = LAST_N_DAYS:365 AND
  29. Status = 'Attended'
  30. ]);
  31. }
  32. global void execute(Database.BatchableContext bc, List<Account> records){
  33. // process each batch of records
  34. }
  35. global void finish(Database.BatchableContext bc){
  36. // execute any post-processing operations
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement