Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. trigger Contact_details_on_task on Task (before insert) {
  2. list<task> t=[select whoid,description from task];
  3. string iid;
  4. set<id> s=new set<id>();
  5. set<id> whoid=new set<id>();
  6. for(task t1:t){
  7. s.add(t1.whoid);
  8. }
  9. for(task t3:trigger.new){
  10. iid =t3.whoid;
  11.  
  12. }
  13.  
  14. for(contact a2:[select id from contact where id=: iid]){
  15. whoid.add(a2.id);
  16. }
  17. list<contact> a=[select phone,name,Email,Mailingcity,Mailingstate,Mailingcountry,Mailingstreet,MailingCountryCode from contact where id in : whoid];
  18. system.debug(a);
  19. for(contact a1:a){
  20. for(task t2:trigger.new){
  21. string descr = t2.description == null ? 'blank' : t2.description;
  22. t2.description=descr +' rn'+a1.phone + ' rn'+a1.name+ ' rn'+a1.Mailingcity+ ' rn'+a1.Mailingstate+ ' rn'+a1.Mailingstreet+' rn'+a1.Mailingcountry+ 'rn'+a1.MailingCountryCode +'rn'+a1.email;
  23. }}
  24. update t;
  25. }
  26.  
  27. for(task t2:trigger.new){
  28. string descr = t2.description == null ? 'blank' : t2.description;
  29. t2.description=descr +' rn'+a1.phone + ' rn'+a1.name+ ' rn'+a1.Mailingcity+ ' rn'+a1.Mailingstate+ ' rn'+a1.Mailingstreet+' rn'+a1.Mailingcountry+ 'rn'+a1.MailingCountryCode +'rn'+a1.email;
  30. }}
  31. // update t;
  32.  
  33. try {
  34. //your code here
  35. } catch(Exception e) {
  36. System.debug('Exception type caught: ' + e.getTypeName());
  37. System.debug('Message: ' + e.getMessage());
  38. System.debug('Cause: ' + e.getCause()); // returns null
  39. System.debug('Line number: ' + e.getLineNumber());
  40. System.debug('Stack trace: ' + e.getStackTraceString());
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement