New answers tagged

1

First of all, it should be in bulk. You should consider what would happen if a bulk load of records comes in. You could hit the 50 future calls per transaction limit if there's 51 leads loaded at once. Second, yes, you need to not make a future call inside a future method. This recursion is specifically blocked. Here's the fix for the class: public with ...


0

Map<Id,Parent__c> parMap = new Map<Id,Parent__c>([SELECT Id,(SELECT Id from Child__r) from Parent__c WHERE ID IN: oldMap.keyset()]); for(Parent__c parent : oldList){ if(parMap.containskey(parent.Id)){ if(parMap.get(parent.Id).Child__r.size() > 0){ parent.addError('Parent can not be deleted as its having ...


Top 50 recent answers are included