Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger remeetUpdate on Event (after update) {
- Event e = Trigger.new[0];
- List<Contact> c = [
- 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
- FROM Contact
- Where Contact.Id = :e.WhoId
- ];
- if (e.Write_up_completed__c == True && e.Type__c == 'Remeet') {
- // chop up the comments field
- // stick them in the write-up field
- String comments = e.Comments__c;
- List<String> sections = new List<String>();
- List<String> contactFields = new List<String>();
- contactFields.add('Person_s_met_Place_met__c');
- contactFields.add('Personality_Impression__c');
- contactFields.add('Current_Responsibilities__c');
- contactFields.add('Additional_Information__c');
- contactFields.add('Companies_met_in_the_past__c');
- contactFields.add('Companies_Introducing_to__c');
- contactFields.add('Hot_Buttons__c');
- List<String> commentArray = new List<String>();
- sections = comments.split('IMPRESSION:|CURRENT POSITION/ RESPONSIBILITIES:|ADDITIONAL INFORMATION:|COMPANIES MET RECENTLY:|COMPANIES INTRODUCING TO:|UPDATED HOT BUTTONS:');
- for (Integer i = 0; i < sections.size(); i++) {
- if (i == 0) {
- sections[0] = sections[0].replace('CONSULTANTS MET, DATE, AND PLACE:', 'REMEET ' + e.StartDateTime);
- sections[0] = sections[0] + '*****' + 'n';
- commentArray.add(sections[0]);
- } else {
- commentArray.add('REMEET ' + e.StartDateTime + sections[i] + '*****' + 'n');
- }
- }
- for (Integer j = 0; j < commentArray.size(); j++) {
- c[0].put(contactFields[j], commentArray[j] + c[0].get(contactFields[j]));
- }
- update c[0];
- }
Add Comment
Please, Sign In to add comment