Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. global database.QueryLocator start(database.BatchableContext bc){
  2. return database.getQueryLocator('Select id,MemberShip__c,Two__c,name From Account');
  3. }
  4.  
  5. global void execute(database.BatchableContext bc,list<Account> acc){
  6.  
  7. list<string> se=new list<String>();
  8.  
  9. for(Contact c:con){
  10. if(c.AccountId!=null){
  11. se.add(c.MemberShip__c);
  12. }
  13. }
  14. for(Account a:[Select id,MemberShip__c,Two__c,name From Account where id in:se]){
  15. a.MemberShip__c=string.join(se,',');
  16. acc.add(a);
  17. }
  18. update con;
  19. }
  20. global void finish(database.BatchableContext bc){
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement