-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
6Questions
-
2Replies
How to write test class apex mail for below trigger.
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
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
- srikanth reddy 27
- January 05, 2017
- Like
- 0
- Continue reading or reply
Trigger On Account page with regards to Opportunity
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
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
- srikanth reddy 27
- January 22, 2016
- Like
- 0
- Continue reading or reply
- srikanth reddy 27
- November 25, 2014
- Like
- 0
- Continue reading or reply
- srikanth reddy 27
- November 18, 2014
- Like
- 0
- Continue reading or reply
- srikanth reddy 27
- November 13, 2014
- Like
- 0
- Continue reading or reply
write trigger for contact object custom field primary of type checkbox
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).
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).
- srikanth reddy 27
- July 22, 2014
- Like
- 0
- Continue reading or reply
- srikanth reddy 27
- November 13, 2014
- Like
- 0
- Continue reading or reply
write trigger for contact object custom field primary of type checkbox
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).
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).
- srikanth reddy 27
- July 22, 2014
- Like
- 0
- Continue reading or reply