0
  1. If the Value previously was 0 and the new value is greater than 0 do not send an email (if the status of the meeting is 'close out required' in Centris)
  2. If the Value previously was 5 (for example) and the new Value is 6 (for example) Send an email.
  3. If the Value previously was 5 (for example) and the new value is 3 (for example) send an email.
  4. If the meeting was 'financially reconciled'(Financial Closed Date, ahm__Financial_Closed_Date__c) and the Value changes to any greater or lesser value (including from 0 to a greater value) send an email for 'Financially reconciled' = In Centris (Salesforce), in Interaction History there is an entry like "Changed Financial Closed Date to"

I have written following and I want to help, how can I send mail for one condition and don't send mail to other condition

        if(((Trigger.oldMap.get(objMeetinginfo.id).ahm__Non_Profiled_Attendee_Meal_Count__c != objMeetinginfo.ahm__Non_Profiled_Attendee_Meal_Count__c) &&
        (objMeetinginfo.ahm__status__c =='close out required')) ****Send Mail****
        ||
         ((Trigger.oldMap.get(objMeetinginfo.id).ahm__Non_Profiled_Attendee_Meal_Count__c != objMeetinginfo.ahm__Non_Profiled_Attendee_Meal_Count__c) &&
        (objMeetinginfo.ahm__status__c =='ahm__Financial_Closed_Date__c'))) ***Not Send Mail****
3
  • where you have commented send email call a method and fro that method send email. Nov 25, 2016 at 7:22
  • I never send could you please give me format please Nov 25, 2016 at 8:01
  • 1
    @CodeDictator google for Messaging.SingleEmailMessage examples.
    – EvAzi
    Nov 25, 2016 at 8:26

1 Answer 1

1

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm here is an example of constructing an email:

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
// Set recipients to two contact IDs.
// Replace IDs with valid record IDs in your org.
message.toAddresses = new String[] { '003D000000QDexS', '003D000000QDfW5' };
message.optOutPolicy = 'FILTER';
message.subject = 'Opt Out Test Message';
message.plainTextBody = 'This is the message body.';
Messaging.SingleEmailMessage[] messages = 
    new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

You need to think about what happens when you need to send many emails...what do you want to happen if no email is sent...why do you even need to check for those conditions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .