Auto Notification Emails not firing when Process Builder is invoked within same transaction
Last updated 2018-04-12 ·Reference W-3338213 ·Reported By 242 users
Summary
For transactions supposed to send automated email notifications, if there is a process builder visual workflow invocation within the same transaction, email notification is not fired.
Repro
- This can be reproduced in any local dev org
Below are few examples:
1. Create a user 'usera@salesforce.com' and set the user contact email to your email.
2. Open up developer console anonymous window, excecute:
User u = [select id from user where username='usera@salesforce.com' limit 1];
Task t = new Task(ownerid=u.id, subject= 'Test Email',activitydate=System.today());
List<Task> taskToCreate = new list<task>();
taskTocreate.add(t);
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true;
dlo.optAllOrNone = true;
database.insert(taskToCreate, dlo);
3. You should receive a email notifying you that a task is assigned to you.
4. Create any process builder on task.
5. Rerun the code chunk in 2 in developer console.
6. You will no longer get task notification email
----------------------
Same scenario applies to other automated email notifications. Other example :
New user activation emails when there is a process builder visual workflow performing a field update on the user.
Repro:
Have a process builder visual workflow update a user field for new user:
Run this code to insert the user:
user objUser= new user();
objUser.FirstName = 'testUserFname';
objUser.LastName = 'testUserLname';
objUser.Email = 'email@example.com';
objUser.Department = 'testDpt';
objUser.Title = 'testTitle';
objUser.City = 'Sydney';
objUser.Country = 'Australia';
objUser.ProfileId= '<profileId>' ;
objUser.TimeZoneSidKey = 'Europe/Amsterdam';
objUser.Username = 'unique@example.com';
objUser.CommunityNickname='testNick';
objUser.Alias='testAlias';
objUser.EmailEncodingKey = 'ISO-8859-1';
objUser.LanguageLocaleKey = 'en_US';
objUser.LocaleSidKey = 'en_US';
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true;
dlo.EmailHeader.triggerAutoResponseEmail = true;
objUser.setOptions(dlo);
system.debug(objuser.username);
insert objUser;
-You will no longer receive user activation email
Note: This is not a bug, but a feature limitation with process builder
Workaround
Use workflow instead of process builder
Reported By (242)














































































Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.