3

Is there a way to trigger the "Save and Send Update" button's functionality with Apex? I want to send the same email message for the invitees on an Event trigger.

I tried something as follows but nothing happens,

public class sendSaveUpdateMail implements Triggers.Handler {
    public void run(){
        if(!(Trigger.isAfter && Trigger.isUpdate)) return;
        if (IS_TRIGGER_RAN) { // static variable to keep track on trigger recursive run
            return;
        } else {
            IS_TRIGGER_RAN = true;
        }

        Set<Id> erids = new Set<Id>();

        List<Event> events = new List<Event>();

        for (Event e : (List<Event>)trigger.new){
            erids.add(e.id);
        }

        List<EventRelation> eventRelations = [SELECT Id, RelationId From EventRelation where eventid IN:erids];

        Database.DMLOptions dlo = new Database.DMLOptions();
        dlo.EmailHeader.triggerUserEmail  = true;

        Database.update(eventRelations,dlo);  
    }
}

Thanks in advance.

  • Hi! Did you find the way to acomplish that? – Viktor Oct 6 '16 at 10:07
1

check your email Deliverability settings.

setup -> Email Administration -> Deliverability -> Access level = ALL EMAILs

hope this will solve your problem

|improve this answer|||||
  • I already have Access level setup on Deliverability for "All Emails" – Hasantha Aug 19 '15 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.