• yujohwan99
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 10
    Replies
When I make a new contact to test this code, it works perfectly fine. However, when trying to mass update over 20000 or so records, I receieve an "attempt to dereference a null object" error on the for each loop. I'm not sure why this is the case. Is this because I hit a governor limit? 

List<String> joinDate = new List<String>();

Schema.DescribeFieldResult fieldResult = Contact.JoinDate__c.getDescribe();
List<Schema.PicklistEntry> pEntries = fieldResult.getPicklistValues();

for (Schema.PicklistEntry pEntry : pEntries)
{
    String pe = pEntry.getValue();
    if (pe.startsWith('1') || pe.startsWith('200') || 
        (pe.startsWith('201') && !pe.equals('2019'))){
        joinDate.add(pe);
    }
}

List<Contact> massupdate = new List<Contact>();

List<Contact> cons = [SELECT Id, Name, npe01_WorkEmail__c 
                     FROM Contact 
                     WHERE Join_Date__c IN :joinDate];
system.debug('Number of records in list above' + cons.size());

For(Contact c: cons){
    if(c.npe01_WorkEmail__c.endsWithIgnoreCase('it.work.com')){
        System.debug('>>>>>>>>>' + c.npe01_WorkEmail__c);
        c.npe01_WorkEmail__c = null;
        massupdate.add(c);
    }
}

if(!massupdate.isEmpty()){
    update massupdate;
}
I'm trying to mass update a specific field using developer's console, but I only end up deleting the record itself. Here is my code: 

Contact[] contactDel = [SELECT Email__c FROM Contact
   WHERE Join_Date__c <= '2000'
   AND Email__c LIKE '%it.work.com’];

delete contactDel;

I'm currently trying to mass delete an email field that ends with "it.work.com," but only from people who joined on or before the year 2000. I don't want to necessarily remove the field from the record, but just delete the entry so that it's blank. However, this ends up deleting the whole record. Is there another way to do this? Maybe such as retrieving the ID's of these record? 
I added a button to my Opportunities that sends an email with a template and autofilled fields using javascript. However, this button does not appear in lightning since it doesn't support JS. Is there another alternative to replace this button, so I can have a visible button on both classic and lightning? 
I've read many posts and articles regarding URL hacking or using javascript, but I am unable to figure out how to get the button to work. I went through the Salesforce Developer Workshop on trailhead, so I am somewhat familiar with some of the jargon, such as fields, custom objects, etc. 

Currently, I created a detail page button called Send Email on my Speaker object, but I cannot make the button work. I have no clue as to where to start. 
I'm trying to mass update a specific field using developer's console, but I only end up deleting the record itself. Here is my code: 

Contact[] contactDel = [SELECT Email__c FROM Contact
   WHERE Join_Date__c <= '2000'
   AND Email__c LIKE '%it.work.com’];

delete contactDel;

I'm currently trying to mass delete an email field that ends with "it.work.com," but only from people who joined on or before the year 2000. I don't want to necessarily remove the field from the record, but just delete the entry so that it's blank. However, this ends up deleting the whole record. Is there another way to do this? Maybe such as retrieving the ID's of these record? 
I added a button to my Opportunities that sends an email with a template and autofilled fields using javascript. However, this button does not appear in lightning since it doesn't support JS. Is there another alternative to replace this button, so I can have a visible button on both classic and lightning? 
I've read many posts and articles regarding URL hacking or using javascript, but I am unable to figure out how to get the button to work. I went through the Salesforce Developer Workshop on trailhead, so I am somewhat familiar with some of the jargon, such as fields, custom objects, etc. 

Currently, I created a detail page button called Send Email on my Speaker object, but I cannot make the button work. I have no clue as to where to start.