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
Almejas AlmejasAlmejas Almejas 

Help regarding bulk uploads using dataloader!

There is a current trigger for Property Object for new records created in Salesforce that will check the address in Zillow (API)  and then update the field Parcel ID when the address is located. However, when I use dataloader for new records bulk upload, this trigger isn't firing. I still have to manually update each Property and refresh for the trigger to fire. Can you please help me with how I can fix this to work on bulk uploads?

Here is the PropertyHandler trigger that I can see in Dev Console:

public class PropertyDetailsHandler {
    public static Integer counter;
    static {
        counter = 1;
    }
    
    public static void checkAddress(List<Property_Details__c> newList, List<Property_Details__c> oldList){
        Set<Id> udpatedList = new Set<Id>();
        for(Integer i=0; i< newList.size(); i++){
            if(newList[i].Street_Address__c != oldList[i].Street_Address__c 
               ||
               newList[i].Unit_Number__c != oldList[i].Unit_Number__c 
               ||
               newList[i].State__c != oldList[i].State__c 
               ||
               newList[i].City__c != oldList[i].City__c
               ||
               newList[i].Postal_Code__c != oldList[i].Postal_Code__c){
                   udpatedList.add(newList[i].Id);
                   updateName(newList[i]);
                       
               }
        }
        if(udpatedList.size() > 0){
            
            if(System.Label.Is_Zillow_Active == '1' || Test.isRunningTest()){
                ZillowController.updateFromZillow(udpatedList);
            }
            if(System.Label.Is_Zillow_Active == '0'){
                BridgeController.updateFromBridge(udpatedList);
            }
        }
    }
    
    public static void updateName(Property_Details__c prop){
        prop.Name = '';
        if(prop.Street_Address__c != null &&prop.Street_Address__c != ''){
            prop.Name =prop.Street_Address__c;
        }
        if(prop.Unit_Number__c  != null &&prop.Unit_Number__c != ''){
            if(prop.Name != ''){
                prop.Name += ', #' +prop.Unit_Number__c; 
            }
        }
        
        if(prop.City__c  != null && prop.City__c != ''){
            if(prop.Name != ''){
                prop.Name += ', ' + prop.City__c; 
            }
        }
        
        if(prop.State__c  != null && prop.State__c != ''){
            if(prop.Name != ''){
                prop.Name += ', ' + prop.State__c; 
            }
        }
        
        if(prop.Postal_Code__c  != null && prop.Postal_Code__c != ''){
            if(prop.Name != ''){
                prop.Name += ' ' + prop.Postal_Code__c; 
            }
        }
        if(prop.Name != '' && prop.Name.length() >80){
            prop.Name = prop.Name.left(80);
        }
    }
}
 
Santosh Kumar 348Santosh Kumar 348
Hi Almejas,

Can you post the trigger part as well? As code above dosen't give any clear picture on which event you are calling which methods.

Regards,
Santosh
Almejas AlmejasAlmejas Almejas
@Santosh, It's part of an API because it is hidden when I click it. Do you have any idea what to do?
Santosh Kumar 348Santosh Kumar 348
Hi Aljemas,

Has your issue been resolved? As you can access the handler of the code so I guess the trigger must not be a part managed package. So pkease cross check for same.

Regards,
Santosh Kumar