• kanchan tyagi 2
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
trigger SendConformationEmail on k113__Session_Speaker__c (after insert) {
    list<id> sessionspeakerid = new list<id>();
    for(k113__Session_Speaker__c newItem : trigger.new) {
        sessionspeakerid.add(newItem.Id);  
    }
       List<k113__Session_Speaker__c> ss =
            [SELECT k113__Session__r.Name,
                    k113__Session__r.Session_Date__c,
                    k113__Speaker__r.First_Name__c,
                    k113__Speaker__r.Last_Name__c,
                    k113__Speaker__r.Email__c
             FROM k113__Session_Speaker__c WHERE Id IN :sessionspeakerid];
          system.debug(ss[0]);

    if(ss.size() > 0) {
        
         if (ss.k113__Speaker__r.Email__c != null) {
                String address = ss.k113__Speaker__r.Email__c;
                String subject = 'Speaker Confirmation';
                String message = 'Dear ' + ss.k113__Speaker__r.First_Name__c +
                    ',\nYour session "' + ss.k113__Session__r.Name + '" on ' +
                    ss.k113__Session__r.Session_Date__c + ' is confirmed.\n\n' +
                    'Thanks for speaking at the conference!';
                EmailManager.sendMail(address, subject, message);
            }
        }
        
        
        
    }
 
Write a trigger on QuoteLine Items that will calculate the sum of Tax__c formula field (List Price + 9% of listprice) on Quote line item object with check box Taxable__c set to true and display that sum on TotalTax__c field on Quote. create the necessary fields before creating trigger. write a test class of the trigger with at least 90 % code coverage
trigger contactCounttriger on Contact (After insert, After Delete, After Undelete,after update) { Set<id> setAccountId=new Set<id>(); if(Trigger.isInsert || Trigger.isUndelete || Trigger.isUpdate){ for(Contact con:Trigger.New){ setAccountId.add(con.AccountId); } } if(Trigger.IsDelete){ for(Contact con:Trigger.old){ setAccountId.add(con.AccountId); } } List<Account> listAcc=[select id,no_of_contacts__c,(Select id from Contacts)from Account where id in:setAccountId]; for(Account acc:listAcc){ acc.no_of_contacts__c=acc.contacts.size(); } update listAcc; }