5
Task t = new Task();
t.WhatId = 'custom object Id';
t.OwnerId = 'userid';
t.Subject = 'Test';
t.Priority = 'High';
t.Status = 'Test Status';
t.Description = 'Test Note.Description__c';

Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true;
t.setOptions(dlo);
List<Database.saveresult> sr = Database.insert(new list<Task>{t},dlo);

trying to execute code in dev console but user is not receiving any email.

2
  • Your code says triggerUserEmail = false, shouldn't that be TRUE.
    – Matt M
    Commented Oct 6, 2016 at 20:55
  • @MattM ahh yeah may be typo.. thanks for pointing this out.
    – Ratan Paul
    Commented Oct 7, 2016 at 4:53

1 Answer 1

2

Found the issue. under Activity Settings we need to check Enable User Control over Task Assignment Notifications checkbox.

You must log in to answer this question.

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