Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger Contact_details_on_task on Task (before insert) {
- list<task> t=[select whoid,description from task];
- string iid;
- set<id> s=new set<id>();
- set<id> whoid=new set<id>();
- for(task t1:t){
- s.add(t1.whoid);
- }
- for(task t3:trigger.new){
- iid =t3.whoid;
- }
- for(contact a2:[select id from contact where id=: iid]){
- whoid.add(a2.id);
- }
- list<contact> a=[select phone,name,Email,Mailingcity,Mailingstate,Mailingcountry,Mailingstreet,MailingCountryCode from contact where id in : whoid];
- system.debug(a);
- for(contact a1:a){
- for(task t2:trigger.new){
- string descr = t2.description == null ? 'blank' : t2.description;
- 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;
- }}
- update t;
- }
- for(task t2:trigger.new){
- string descr = t2.description == null ? 'blank' : t2.description;
- 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;
- }}
- // update t;
- try {
- //your code here
- } catch(Exception e) {
- System.debug('Exception type caught: ' + e.getTypeName());
- System.debug('Message: ' + e.getMessage());
- System.debug('Cause: ' + e.getCause()); // returns null
- System.debug('Line number: ' + e.getLineNumber());
- System.debug('Stack trace: ' + e.getStackTraceString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement