• Gilberto Charpentier
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
If your trying to run the latest DataLoader 49.0.0 on a Mac with OS 11 (Big Sur) beta it'll only show you blank windows.
This happens also with other Java Apps using older versions of the Eclipse SWT libraries (and is a known issue).
Can we expect a newer version of Data Loader using the latest Eclipsw SWT libraries in the package?

Thx - Andreas
I want to update the email optout field from converted contact to the existing contacts. For ex lets say i have 3 contacts with same email address(email@gmail.com) and emailoptout not checked and iam converting new lead with emailoptout box checked and has same email(email@gmail.com), i want my trigger to update the email optout box to true on these 3 existing contacts. 

trigger updateLeadOnEmailOptOut on Lead (after update) {
    List<Lead> duplicateLeads = new List<Lead>();
    Map<String, Lead> leadEmailMap = new Map<String, Lead>();
    Map<Id, Lead> leadIdMap = new Map<Id, Lead>();
    Map<Id, Contact> contacts = new Map<Id, Contact>();

    for (Integer i = 0; i < Trigger.new.size(); i++) {
        if (Trigger.old[i].HasOptedOutOfEmail != Trigger.new[i].HasOptedOutOfEmail) {
            leadEmailMap.put(Trigger.old[i].email, Trigger.new[i]);
            leadIdMap.put(Trigger.old[i].id, Trigger.new[i]);        
        }
    }    

    If (leadIdMap.size()>0) {


        for (Lead dupLead : [SELECT Id, Name, Email, HasOptedOutOfEmail
                             FROM Lead
                             WHERE Email IN : leadEmailMap.KeySet()
                             AND Id NOT IN : leadIdMap.KeySet()
                             AND IsConverted = FALSE]) {
                                 Lead lead = leadEmailMap.get(dupLead.Email);
                                 If (dupLead.HasOptedOutOfEmail <> lead.HasOptedOutOfEmail) { 
                                     dupLead.HasOptedOutOfEmail = lead.HasOptedOutOfEmail;   
                                     duplicateLeads.add(dupLead);
                                 }
                             }    

        If (duplicateLeads.size()>0) update duplicateLeads;
    }
    for(Lead record: Trigger.new) {
        if(record.ConvertedContactId != null) {
            contacts.put(record.ConvertedContactId, new Contact(Id=record.ConvertedContactId, HasOptedOutOfEmail=record.HasOptedOutOfEmail));
        }
    }
    update contacts.values(); 
}