You need to sign in to do that
Don't have an account?
![John Athitakis John Athitakis](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Apex Code not working via data loader
Scratching my head--works fine in the UI, but not via data loader. Any suggestions?
GIST: Check to see if company name is in another table, OR in some other conditions (basic if then) flag a field as true on lead. Nothing complex. Why is Data Loader skipping it?
trigger LeadAssignmentRuleTest on Lead (before insert) { for (Lead a : Trigger.new) { List<Inside_View_Company__c> b= [select id, Account_Name__c from Inside_View_Company__c where Account_Name__c = :a.Company LIMIT 1]; if(!b.isEmpty() || a.Event_Temperature__c=='Hot'|| a.Event_Temperature__c=='Warm') { a.Direct_to_Sales__c=True; } if(!String.isblank(a.Form_Name__c)){ if(a.Form_Name__c.containsIgnoreCase('buy') || a.Form_Name__c.containsIgnoreCase('inquiry')){ a.Direct_to_Sales__c=True; } } } }
Here is more information on best practice: https://developer.salesforce.com/page/Best_Practice%3A_Bulkify_Your_Code