You need to sign in to do that
Don't have an account?
How to Visualforce page Update Through A site
trigger sendFeedback on Opportunity (before update) {
for(Opportunity b : trigger.new){
if(b.Interested_In_Feedback__c == true && b.Feedback_Received__c == false && b.Shipment_Status__c == 'Delivered'){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
Contact recipient = [SELECT id,firstname from Contact where id=:b.Customer__c];
//EmailTemplate et = [SELECT id FROM EmailTemplate WHERE developerName = 'CustomerFeedbackRequest'];
mail.setSenderDisplayName('FeedBack System');
mail.setTargetObjectId(recipient.id);
//mail.setTemplateId(et.id);
mail.setSubject('Feedback Request');
//mail.setPlainTextBody('Dear' +recipient.FirstName + ' Sir or Madam');
mail.setHtmlBody('Dear ' +recipient.FirstName +
'<p>Thank you for your interest in providing your valueable Feedback <p> Please click the link below <p>'+
'<a href=http://rz-developer-edition.ap1.force.com/CustomerFeedback?id='+b.Customer__c+'&bid='+b.Id+'>FeedBack Request Link</a>'+
'<p> Thanks And Regards <p> Feedback Team');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
}
}
}
Gaurav Shukla
Force.com Developer
CloudSteer Technology Pvt Ltd..
If you are looking to share code samples, please submit them to the Cookbook section of developer.force.com, and not the discussion boards.
http://developer.force.com/cookbook