• srikanth reddy 27
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
How to write test class below trigger.
how to write test class for bold lines.

trigger COMP3000 on Account(After insert,After Update) {

  List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();

    Account COMP =[SELECT ID,name,Client_Email__c,Client_Name__c,Expiry_Date__c,payment_Status__c,Complimentary_Coupon_Type__c from Account where id=: trigger.new] ;

 for Account COMP1 : Trigger.new){
    if( COMP.Complimentary_Coupon_Type__c =='Voucher'&& COMP.payment_Status__c==TRUE){
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        List<String> sendTo = new List<String>();
      sendTo.add(COMP.Client_Email__c);
      mail.setToAddresses(sendTo);
        
         mail.setSubject(' Test');
      String body = 'Dear ' + comp.Client_Name__c +  ', ';
      body += '<br/>Thank for you for registering us.<br/>';
      body += 'We are happy to offer aCoupon worth Rs .';
      body += 'This coupon has a validity of xxxxx;
      body += '<br/>Thank for you for registering us.<br/> ';
      body += 'Thank for you for registering us. <br/> ';
      body += 'Regards<br/>xxxxx <br/>';
      mail.setHtmlBody(body);
        
              mails.add(mail);

    }
    }
      Messaging.sendEmail(mails);


}
Thanks
Srikanth
Hi all,

Please help me to write a trigger to get a field update on the account page. Whenever two opportunities of a specific record type for ex Test1 and Test2 are created, i need a field update on the account page which gets checked to know that the account holder has those opportunities. 

            Please help

Thanks
Sam
Hi,
I am new in salesforce integration pls. 
 
hi friends ,
pls help me to write following trigger
here contact is having custom field primary of type checkbox
● Each account may have multiple contacts but only one marked “Primary”
● Each account must have 1 primary contact.
● The account should display the name of its primary contact on the account detail screen (i.e. in a field).
Hi,
I am new in salesforce integration pls. 
 
hi friends ,
pls help me to write following trigger
here contact is having custom field primary of type checkbox
● Each account may have multiple contacts but only one marked “Primary”
● Each account must have 1 primary contact.
● The account should display the name of its primary contact on the account detail screen (i.e. in a field).