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.

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

1 Answer 1

1

check your email Deliverability settings.

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

hope this will solve your problem

1
  • I already have Access level setup on Deliverability for "All Emails"
    – Hasantha
    Commented Aug 19, 2015 at 6:08

You must log in to answer this question.

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