Guest User

Untitled

a guest
Dec 9th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. trigger remeetUpdate on Event (after update) {
  2. Event e = Trigger.new[0];
  3.  
  4. List<Contact> c = [
  5. SELECT Id, Person_s_met_Place_met__c, Current_Responsibilities__c, Personality_Impression__c, Additional_Information__c, Hot_Buttons__c, Companies_Introducing_to__c, Companies_Met_in_the_past__c
  6. FROM Contact
  7. Where Contact.Id = :e.WhoId
  8. ];
  9.  
  10. if (e.Write_up_completed__c == True && e.Type__c == 'Remeet') {
  11. // chop up the comments field
  12. // stick them in the write-up field
  13.  
  14. String comments = e.Comments__c;
  15. List<String> sections = new List<String>();
  16.  
  17. List<String> contactFields = new List<String>();
  18. contactFields.add('Person_s_met_Place_met__c');
  19. contactFields.add('Personality_Impression__c');
  20. contactFields.add('Current_Responsibilities__c');
  21. contactFields.add('Additional_Information__c');
  22. contactFields.add('Companies_met_in_the_past__c');
  23. contactFields.add('Companies_Introducing_to__c');
  24. contactFields.add('Hot_Buttons__c');
  25.  
  26. List<String> commentArray = new List<String>();
  27.  
  28. sections = comments.split('IMPRESSION:|CURRENT POSITION/ RESPONSIBILITIES:|ADDITIONAL INFORMATION:|COMPANIES MET RECENTLY:|COMPANIES INTRODUCING TO:|UPDATED HOT BUTTONS:');
  29. for (Integer i = 0; i < sections.size(); i++) {
  30. if (i == 0) {
  31. sections[0] = sections[0].replace('CONSULTANTS MET, DATE, AND PLACE:', 'REMEET ' + e.StartDateTime);
  32. sections[0] = sections[0] + '*****' + 'n';
  33. commentArray.add(sections[0]);
  34. } else {
  35. commentArray.add('REMEET ' + e.StartDateTime + sections[i] + '*****' + 'n');
  36. }
  37. }
  38.  
  39. for (Integer j = 0; j < commentArray.size(); j++) {
  40. c[0].put(contactFields[j], commentArray[j] + c[0].get(contactFields[j]));
  41. }
  42.  
  43. update c[0];
  44. }
Add Comment
Please, Sign In to add comment