You need to sign in to do that
Don't have an account?
Steven Wellman 28
How could I bulkify this trigger:
trigger PaymentProcessed on Zuora__ZInvoice__c (before update) { for (Zuora__ZInvoice__c inv : Trigger.new) { if (inv.Zuora__PaymentAmount__c > 0) { List<Account> accs = [SELECT Id, Payment_Processed__c, Payment_Collected__c, Most_Recent_Payment__c FROM Account WHERE Id = :inv.Zuora__Account__c]; for (Account acc : accs) { if (acc.Payment_Collected__c == null) { acc.Payment_Processed__c = true; acc.Payment_Collected__c = Date.today(); acc.Most_Recent_Payment__c = Date.today(); } else { acc.Most_Recent_Payment__c = Date.today(); } update accs; } } } }
All Answers