function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DrawloopSupportDrawloopSupport 

Email Alert through Workflow does not create an Activity History

Does anyone know why an email alert triggered from a workflow would not be creating the associated activity history? Emails sent through the interface, through Apex, and through the API are all logged in activity history (when the appropriate information is set). The email alert is set to be sent to the Contact Email (standard) field.

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
SimonSmithSimonSmith

I promoted the idea (which I imagine has fallen off the radar because the original idea was posted in 2007) and also just came up with a workaround that might help some others. 

 

First some context. We have a client who wants to have an email automatically sent to leads when they're entered manually, rather than through the web.

 

To enable this and prevent the wrong leads from getting the introduction, we added a tickbox that users tick if they want leads they're entering to receive the email. 

 

We then created a workflow rule to send an email to the email address of the lead entered. Our expectation was that when this email was sent, the lead's Activity History would be updated.

 

As we know, this isn't the case. So here's the workaround:

 

  1. Duplicate the email template that you're using for the outbound email
    For example, we created a template called "Leads: Auto-Introductory Email to Leads" and a second one called "Leads: Auto-Introductory Email to Leads FOR ACTIVITY HISTORY"
  2. Somewhere in the duplicated template, "ref" the ID of the record for which you want to track the activity
    For example, in our duplicated template, we added ref: {!Lead.Id}
  3. Duplicate the original email alert, make it send ONLY to the administrator's Email-to-Salesforce address, and use the duplicated email template with the "ref" in it
So basically, here's what happens.
 
Someone enters a record in Salesforce that triggers the workflow rule.
 
The workflow rule triggers and sends both email alerts. The first alert gets sent to the recipient, in this case a lead. The second alert gets sent directly into Salesforce using the Email-to-Salesforce address. Salesforce then reads the "ref:" tag and assigns the email to the correct record. 
 
Of course, there are some caveats here.
 
The biggest is that each user has a different Email-to-Salesforce address, so if you want an email sent from different users to be recorded, you might have problems. But if you only care about having the email itself recorded, or want the email to come from a single address anyway, this workaround works.
 
It's nowhere near as elegant as the functionality that should exist, but I hope it helps.  

 

All Answers

jkucerajkucera
For which object?  Campaign Member for example doesn't create activities as Tasks & Activities aren't available for the object
DrawloopSupportDrawloopSupport
The email alert is set to be sent to the Contact Email (standard) field. So it is running from the Contact object.
Message Edited by DrawloopSupport on 03-18-2010 10:58 AM
jkucerajkucera
I get the same behavior as you mentioned.  I'll ask the Workflow Product Manager.
MktCnslMktCnsl
I have the same question.  Why wouldn't it create an activity?  This has caused some complication in tracking down what messages are sent and which didn't trigger.
DrawloopSupportDrawloopSupport

John,

 

Any updates?

 

Thanks! 

jkucerajkucera

Update - I was mistaken.  Workflow Email Alerts never create activites (confirmed from workflow PM). 

 

I believe I was confusing them with HTML Mass Emails, which are a different breed.

DrawloopSupportDrawloopSupport

John,

 

Any way we can get the ability to specify whether or not an Email Alert should create an activity added to Salesforce's road map? Why might someone not want an Email Alert to not create an activity? I will search the Idea Exchange for this suggestion.

 

Thanks! 

SimonSmithSimonSmith

I promoted the idea (which I imagine has fallen off the radar because the original idea was posted in 2007) and also just came up with a workaround that might help some others. 

 

First some context. We have a client who wants to have an email automatically sent to leads when they're entered manually, rather than through the web.

 

To enable this and prevent the wrong leads from getting the introduction, we added a tickbox that users tick if they want leads they're entering to receive the email. 

 

We then created a workflow rule to send an email to the email address of the lead entered. Our expectation was that when this email was sent, the lead's Activity History would be updated.

 

As we know, this isn't the case. So here's the workaround:

 

  1. Duplicate the email template that you're using for the outbound email
    For example, we created a template called "Leads: Auto-Introductory Email to Leads" and a second one called "Leads: Auto-Introductory Email to Leads FOR ACTIVITY HISTORY"
  2. Somewhere in the duplicated template, "ref" the ID of the record for which you want to track the activity
    For example, in our duplicated template, we added ref: {!Lead.Id}
  3. Duplicate the original email alert, make it send ONLY to the administrator's Email-to-Salesforce address, and use the duplicated email template with the "ref" in it
So basically, here's what happens.
 
Someone enters a record in Salesforce that triggers the workflow rule.
 
The workflow rule triggers and sends both email alerts. The first alert gets sent to the recipient, in this case a lead. The second alert gets sent directly into Salesforce using the Email-to-Salesforce address. Salesforce then reads the "ref:" tag and assigns the email to the correct record. 
 
Of course, there are some caveats here.
 
The biggest is that each user has a different Email-to-Salesforce address, so if you want an email sent from different users to be recorded, you might have problems. But if you only care about having the email itself recorded, or want the email to come from a single address anyway, this workaround works.
 
It's nowhere near as elegant as the functionality that should exist, but I hope it helps.  

 

This was selected as the best answer
rpr2rpr2

@SimonSmith

Very clever!

max_overloadmax_overload

Definitely a clever workaround! It wont work in my particular scenario but, this thread and your workaround is by far the most helpful i have ever found on this topic.

 

SALESFORCE HEAR ME!!! WE NEED THIS FEATURE.... please?

thrivethrive

Hey Simon!

 

I was trying the same work-around to get an Email Alert into the Activity History, but was having some troubles. I tried the way you had layed out but am wondering where exactly in the Email Template did you Ref: {!Lead.ID}? Does this need any additional coding or to be in the email to SF address? It is not linking for me and I am not understanding how the email to SF is supposed to recognize a Ref from inside the template.

 

My template is an HTML with a Free-form template. Is that glitching things up?

 

Thank you for your creativity!

 

SimonSmithSimonSmith

@WOTH

 

The ref gets populated when the email gets sent. Just put it on its own line. No additional coding required. When the email gets generated, you'll have a line like ref: IDGOESHERE, which Salesforce will read. Just make sure the line looks as follows: 

 

ref: {!lead.id}

 

That's all, really. If you set things up right, Salesforce will populate that when the email's sent, and read it when the email's received. 

thrivethrive

@SimonSmith

 

I must be missing some other step then. On the second email alert you add the Administrator's "Email to Salesforce" address into the "5 extra email" field or do you somehow get that to be the primary email to send to. It allows selection of Users, Related Contacts, etc, but nothing I can see to default to the Email to SF address.

 

The fact that my email is in an HTML Template with letterhead couldn't possibly mess with the ref: could it?

 

Otherwise, I'll have to keep playing with it.

 

Thanks again!

rpr2rpr2

You do need to enable Email-to-Salesforce.  To do this, go to:  Setup | Email Administration | Email to Salesforce.

 

IYou can press Help from within that screen to read about that feature, and more about using it.

nateknatek

This works beautifully. Thanks for the valuable contribution.

crkdealcrkdeal

great work-a-round!
THanks for posting

JesseAJesseA

Nice trick. But looks like this only works for associating emails with matching Opps, Leads or Contacts. Has anybody just used an apex trigger to send the email? Will it or can you save the history that way?

Dave ArmlinDave Armlin

Certainly can see how having activity logged to an object associated with the EmailAlert would be very helpful.

 

https://sites.secure.force.com/success/ideaView?c=09a30000000D9xt&id=08730000000BroKAAS

 

I get around this problem by sending an email via APEX called from a trigger.  The workflow where I used to do an EmailAlert now sets a checkbox field which the trigger code (on lead object after insert after update) calls an @future method in an an APEX class to send the mail.  Works very well yet this and cross object workflow are my biggest disappointments with SFDC workflow. I've solved both problems in triggers. Not having to code, test coverage, and deploy for this type of functionality would be huge.

 

 

rpr2rpr2

A different type of workaround for this is creating a workflow task to go along with the alert, and set it to a closed status.  It wouldn't capture the entire email, but would track that it was triggered to be sent.

 

I really wish a workaround was not needed at all.

ProcureCloudProcureCloud

Great Idea....however, I am having a problem getting Salesforce to automatically assign the email to the related Salesforce.com record based on {!LeadId}.  The email are ending up in the Administrators Unresolved Email.  I have email associations configured to automatically assign to Leads.  Any Ideas?

trmptrmp

ProcureCloud,

 

I think you should have {!Lead.Id} (notice the dot between Lead and Id). You may also need ref: immediately preceeding it. You should be able to see the lead id in the email (when sending and in the activity history). Can you see the Lead Id in the email body of some of the unresolved activities?

ProcureCloudProcureCloud

Thanks for the reply TRMP,

 

Format on my email template is

 

ref:{!Lead.Id}

 

When the email arrives in my unresolved email, the lead id is shown as follows:

 

ref:00QU0000003aikp

 

I did get it to associate by adding my EmailtoSalesforce address as an Addition To : address on the email sent to the lead.  That one is associating to the lead record using the email address on the lead record.

trmptrmp

Ah, yes. You do need the Email to Salesforce address in there, whether it's the Additional To, CC, or BCC.

millencolinmillencolin

I implemented this work aournd successfully but I have the email alerts not only assigned to the leads but also added as unresolved items.

Has anyone else had this and is there a work around?

 

Thanks

dmchengdmcheng

I was able to use SimonSmith's method to log an activity to a custom object, which I didn't think would be possible.  Thanks, Simon!

WindwackoWindwacko

Using an HTML template, I was only able to get this to work with the ref: {!object.id} in the first line of the body. 

 

Great workaround by the way.

Jennifer McNabbJennifer McNabb
Hello everyone,

I'm trying to set this up in my SFDC instance. I've made sure "Email to Salesforce" is activated for us. I'm stuck on step 3 of Simon's steps. I am creating an email alert and it is asking me to pick a recipient type. I see owners, roles, case teams, etc but don't see anywhere to have it send to only the Email-to-Salesforce email. Anyone have insight into this? 
Sravanthi SSravanthi S
@simonsmith : I tried to add Ref:Case.Id .. so that the email alert is logged under the case, but instead it was logged under my contact in SF when i CC'ed the email to salesforce address.

Can you please explain how to proceed from SteP 2. After we have added the Ref ID, how can we create the additional email alert using the cloned template?
Keri-An Richards 9Keri-An Richards 9
Hi all, 
Is there really still no better way to do this - it seems absurd that an email sent from a workflow on a case doesn't record the email onto the case it was triggered from...
Keri-An
trmptrmp
crosariocrosario
Hello  I am stuck in one of the steps- step 3. I already created the email alert and i am not sure what to put in the recipient type. Can someone help?
Olivier AvonOlivier Avon
Hello,
Thanks a lot for your great article.
I dont know why it doesnt work in my organisation.
I tried with the mail-to-Salesforce of 2 administrators.
Does it create a task or a case in the end?
Do i have someting special to configure in order that {!Contact.Id} works?
Thanks a lot for your feedback.
Best
Olivier
Ali AxtAli Axt
@millencolin Same issue here. Did you ever find a solution?
Jason Vance 13Jason Vance 13
I can't believe SimonSmith's answer posted back in 2010 is still the best solution for this, but thanks for posting it! #betterthannothing
DevjeDevje
@millencolin Ali Axt: Has anyone resolved the issue with the email also being in unresolved items?
The workaround works good, but creates beside the activity history also another unresolved email. 
Jennifer CohenJennifer Cohen
I added a Task in the same TIme Dependent marked as the trigger date and closed, seems to work so far.
Syed MoizSyed Moiz
I have tried everything here.
  1. ref: {!Opportunity.Id} in the template
  2. sending email from the My Acceptable Email Addresses list
  3. added my Email to salesforce in the email alert Additional emails
Still, its creating the email task in an unresolved lists. any assistance will be highly valuable as I have hit a blank wall
DevjeDevje
I made a Flow that is autolaunched by the Process that sends the email.
Just a fast lookup for a Task with the Subject: Unresolved email: Subjectname and a fast delete.

that solved the problem for me.
Jason VanceJason Vance
I just unchecked the box next to: "If no matching records are found, create a task for each recipient and send it to My Unresolved Items" in my "My Email to Salesforce" settings. I suspect this worked because the actual email-to-salesforce email address is not associated with any Leads or Contacts (I was getting the email to attach to the appropriate record AND it was going into My Unresolved Items). So when I UNchecked this box, it worked like a charm (and since this is the only thing I use Email-to-Salesforce for, it won't affect anything else). Hope this helps!

User-added image
Erik LarameeErik Laramee
How are people getting the email-to-salesforce address referenced? If I try to reference the actual email address I am getting syntax errors.
Russell__cRussell__c
For Erik and others above, you just add the Email-To-Salesforce address to the Additional To section and save. Despite how it looks you don't need to add an email addresses to the Recipients section.