You need to sign in to do that
Don't have an account?
Nick Keehan
External ID - Large object type (more than 200000 rows)
Hi Guys.
Have made External_Id_1__c and External_Id_2__c an external Id today on both the account object and the lead object however when i am deploying this i am still getting the same 200000 non selectable error. Had a read around and everyone mentions as long as i make the field a external Id it should index and allow more than 200000 records to be queried. We have a large data set.
Any ideas?
If an external ID is entered into the lead, it will add the account number into a lookup field is the idea.
Have made External_Id_1__c and External_Id_2__c an external Id today on both the account object and the lead object however when i am deploying this i am still getting the same 200000 non selectable error. Had a read around and everyone mentions as long as i make the field a external Id it should index and allow more than 200000 records to be queried. We have a large data set.
Any ideas?
If an external ID is entered into the lead, it will add the account number into a lookup field is the idea.
trigger SetAccountField on Lead (before insert, before update) { Set<String> customerCodeSet = new Set<String>(); for (Lead lead : Trigger.new) { customerCodeSet.add(Lead.External_Id_1__c); } Map<String,Account> customerCodeAccMap = new Map<String,Account>(); for(Account acc : [Select Id,External_Id_1__c from Account Where External_Id_1__c IN :customerCodeSet]){ customerCodeAccMap.put(acc.External_Id_1__c,acc); } for (Lead lead : Trigger.new) { if(lead.External_Id_1__c != null && customerCodeAccMap.containsKey(lead.External_Id_1__c)) lead.Related_Account__c = customerCodeAccMap.get(lead.External_Id_1__c).Id; } Set<String> customerCodeSetclarify = new Set<String>(); for (Lead lead : Trigger.new) { customerCodeSetclarify.add(Lead.External_Id_2__c); } Map<String,Account> customerCodeAccMapclarify = new Map<String,Account>(); for(Account acc : [Select Id,External_Id_2__c from Account where External_Id_2__c IN :customerCodeSetclarify]){ customerCodeAccMapclarify.put(acc.External_Id_2__c,acc); } for (Lead lead : Trigger.new) { if(lead.External_Id_2__c != null && customerCodeAccMapclarify.containsKey(lead.External_Id_2__c)) lead.Related_Account__c = customerCodeAccMapclarify.get(lead.External_Id_2__c).Id; } }
See also: