You need to sign in to do that
Don't have an account?
Andreea T
Help with batch class
I want to make one batch class for the following:
I need to create 2 fields in account: AllRevenue and Ytd.
AllRevenue is the SUM of all the Amounts of all Invoices of the Account WHERE Category_Invoice__c != 'Monthly' AND Status__c != 'invoice_canceled' .
Ytd is the SUM of all the Amounts of all Invoices of the Account WHERE Category_Invoice__c != 'Monthly' AND Status__c != 'invoice_canceled' AND Date_Invoice__c= THIS_YEAR AND Date_Invoice__c <= TODAY.
I need to create 2 fields in account: AllRevenue and Ytd.
AllRevenue is the SUM of all the Amounts of all Invoices of the Account WHERE Category_Invoice__c != 'Monthly' AND Status__c != 'invoice_canceled' .
Ytd is the SUM of all the Amounts of all Invoices of the Account WHERE Category_Invoice__c != 'Monthly' AND Status__c != 'invoice_canceled' AND Date_Invoice__c= THIS_YEAR AND Date_Invoice__c <= TODAY.
As per your statement AllRevenue and Ytd is the collective amount of all invoices and I m not sure of what you actually meant in the statement
need to create 2 fields in account: AllRevenue and Ytd.
if you want to store the calculated amount in a field added in account (to be created field AllRevenue and Ytd) then, on which Account record you will set the calculated amount.
The following batch will do the calculation.
I hope the answer is helpful for you
Regards
Karthik