Does the data in "Individual Email Results" get lost when converting a Lead to a Contact? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Kim VlasnikKim Vlasnik 

Does the data in "Individual Email Results" get lost when converting a Lead to a Contact?

One of my users converted a Lead to a Contact, and says that the Individual Email Results from the Lead record were not transferred to the Contact record. There was no existing Contact record to merge with; she created a new Contact record when she converted them. Any ideas? We are using Enterprise edition.
Paul FischerPaul Fischer
Did the user change the email address of the Lead/Contact? 

Has the individual email results related list been added on the Contact page layout?

Check out the exacttarget config guide here and search for individual email results:

Also, you want to make sure you have any exacttarget fields mapped to contacts on conversion. Go to Setup --> Customize --> Leads --> Fields then click the Map Leads Fields button.
Kim VlasnikKim Vlasnik
Thanks for addressing my question, Paul! They did not change the email address, and our Contacts layout does have Individual Email Results visible for this user.

I can't find anything related to converting Leads in the document you linked to, but thanks for pointing me there.

Individual Email Results aren't a mappable field - they're an Activity, are they not?
Paul FischerPaul Fischer
Hi Kim, yes Individual Email Results are an Activity. The only think I can think happened is that they got mass deleted. I would log a case with xacttarget to see if they can shed more light on this--keep me posted. 
Kim VlasnikKim Vlasnik
I've opened a case with Customer Support and will let you know what I find out. Thanks!
Katie DellKatie Dell
Did you ever find a resultion to this?  We are encountering the same issue.
Kim VlasnikKim Vlasnik
Unfortunately, no - and when I spoke with Customer Support, they said because it was a custom object (I inherited an org and this was in place before I got here), they could not offer support. They advised that I contact ExactTarget/Marketing Cloud for support, and I logged a case there, but never heard from them. It was very frustrating. I hope you have a better troubleshooting experience than I did!
Katie DellKatie Dell
I will let you know.  No luck so far though.  Plenty of information on how Marketing Cloud tracks individual email results on the lead or contact but nothing about what happens when you convert that lead.
Katie DellKatie Dell
So it turns out there is an Apex trigger that you can implement to move the lead individual emails to the contact.  We got the instructions and code from Marketing Cloud support.  Not sure if you can retroactively move emails or if it is triggered at the time of conversion but I'm hopeful we can at least avoid this issue going forward!
Tom GriffinTom Griffin
Hey Katie, Would you be willing to share that code? It would be greatly appreciated.
Katie DellKatie Dell
Below is the code we got from MC/ET support.  We hit a few speed bumps since this was our first Apex trigger deployment but our developer got it working last week!


Create New Apex Trigger
trigger individualEmailResultsConversion on Lead (after update) {
Map<ID, Lead> convertedLeads = new Map<ID, Lead>();
for(Lead {
if( lead.isConverted ) {
convertedLeads.put(, lead);
if( convertedLeads.size() > 0 )
xtma_Individual_Email_Result__c[] emailResults = [select id,
Contact__c, Lead__r.ConvertedContactId from xtma_Individual_Email_Result__c
where Lead__c in :convertedLeads.keySet() and Contact__c = ''];
if( emailResults.size() > 0 ) {
for(xtma_Individual_Email_Result__c ier : emailResults) {
ier.Contact__c = ier.Lead__r.ConvertedContactId;
update emailResults;

For Production deployment they listed the trigger configuration as below
User-added image

Test class
"@IsTest" worked alone on config but  "@isTest (seeAllData=true)" was required on production
This is used to open up data access to records in the org. more details on when to use what:
public class individualEmailResultsConversionTests {
public static testmethod void individualEmailResultsConversionTest1() {
Lead[] newLeads = new Lead[0];
try {
Lead lead = new
insert lead;
xtma_Individual_Email_Result__c ier = new
insert ier;
System.debug('initial ier id: ' + ier.Id);
Database.LeadConvert lc = new database.LeadConvert();
LeadStatus convertStatus = [select Id, MasterLabel from
LeadStatus where IsConverted=true limit 1];
Database.LeadConvert[] leadConversions = new
Database.LeadConvert[] { lc };
Database.LeadConvertResult[] results =
}catch(QueryException qe) {

Craig ZehrCraig Zehr
I have added a PB to update the Contat field on the IER, and it is working, but an hour later I look at the IER record and the contact field has been cleared. My guess it is from the MC Connector, but I can't tell for sure. How can I prevent this from happening?
Paul FischerPaul Fischer
I've posted an idea here to make this native functionality of the Marketing Cloud Connector. Please vote for it here:
Jose Manuel Martín FluxáJose Manuel Martín Fluxá
Hi! I suggest a little enhacement. If you use something like method below you don't have to deal with records that are updated but not with a new value on isConverted (from Not Converted to Yes Converted): 
private Set<Id> getConvertedLeadIds(List<Lead> newList, Map<Id, Lead> oldMap) {
        Set<Id> convertedLeadIds = new Set<Id>();
        for (Lead lead : newList) {
            if (lead.IsConverted && !oldMap.get(lead.Id).IsConverted) {
        return convertedLeadIds;
or simple use in the test class this If: 
if (lead.IsConverted && !oldMap.get(lead.Id).IsConverted) {
So you can avoid cases where the Lead record is updated but not change from NOT is Converted to Is Converted.