Salesforce Workflow Email Alert Not Sending Emails

Srinath Therampattil
4 min readMay 11, 2019

What? Isn’t a workflow email alert simple and straight forward? Why doesn’t it send emails?

The email id might be having a typo, you might have to change the email deliverability settings, you might want to test email deliverability to see confirmation that the Salesforce IP is whitelisted — These were a couple (or almost it) of solutions on the Salesforce developer and StackOverflow communities. Except that I had ensured that these were fine.

Let me back up and explain what I was doing:

When a lead record is created in our Salesforce instance, I execute a trigger-based logic to run a Lead assignment engine, that identifies the correct internal user or partner user or queue based on our “enterprise-grade” complex routing logic. Just kidding! No, it’s almost true! If the lead is assigned to a partner, I wanted to notify them that — “Hey there, you got a lead. You better grab them and start working before the SLA kicks in and the lead goes to your competitor”. So, I have the workflow rule that evaluates certain criteria every time the lead record is created/edited and if the criteria matches, executes the email alert. Everything is easier said than done.

Now, the problem is:

The QA team testing this in our staging environment raised a defect that the lead is getting routed perfectly to a partner, but the partner user is not receiving the emails. My first assumption was criteria might not have been satisfied with the data that the team tried. I setup debug logs to check if the data was valid and could satisfy the workflow rule criteria. I could see that the values were right and the workflow rule criteria were getting satisfied.

Workflow criteria are satisfied

Wow! Then why is the lead owner (partner) not getting the email? I dug further into the logs to find the place where the email alert was getting executed and it said “Email Sent”.

Workflow email alert executed

However, as you could see above, there are no details about the email id to which it was sent and the id of the email template. That’s a bummer. Shouldn’t have happened. That was the place where I don’t have any other information to continue by debugging. So, I created a support case with Salesforce and I had a support rep jump on to the call to take a look at this. That meeting was not very fruitful. The support team said that they could add field update actions to the workflow rule and try if those are getting executed. My thought was — yes, it would! As the rule criteria are getting satisfied, the field updated would work.

After that meeting, I went to check the details of the lead owner user record. To double check, if there was no “Email-opt-out” or something! Good that I checked the user record — I noticed something. The user was not “Active”🤦‍♂. Since the user was not active, Salesforce didn’t want to send email to the user and hence the email id was not appearing in the logs. Now everything started making sense. I went ahead and activated the user and tried the lead creation-email sending — there you go, the partner user receives the email. I had checked various things including the user email id, email preferences, profiles, debug logs and more, but the thought about checking if the user was active or not, never strike my mind.

The logs after the user were made active

Moral:

Your customization skills/logical skill/debug logs are not gonna help if you forget the basics. Phew!

What could have been done:

Your first step determines the direction where you are going. In this case, my step was behind the criteria data and that ended me at the dead end of the debug logs. If my first step were to check if the user was “Active”, I would have resolved this immediately. So, just don’t jump into conclusions or assumptions, but rather get the facts, think and take the first step in the right direction.

An idea for the Salesforce team:

If the email log could indicate that the user was inactive or the actual sending of email was not executed, I wouldn’t have hit the dead-end. I would have solved this. I have created an “idea” on the community here — https://success.salesforce.com/ideaView?id=0873A0000003deoQAA

If you think, this is something that you want, please go ahead and vote for the idea. More are the number of votes, Salesforce implements the feature.

--

--