function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andreea TAndreea T 

How to write a batch for only one Account to update YtDRevenue field if the related Invoices SUM(Normalized_Amount__c) NormalizeAmount, Grouping(Account__c), Account__c FROM Invoice__c

How to write a batch for only one Account to update YtDRevenue field if the related Invoices SUM(Normalized_Amount__c) NormalizeAmount,
FROM Invoice__c   
WHERE Category_Invoice__c != 'Monthly'
AND Status__c != 'invoice_canceled' 
AND Date_Invoice__c= THIS_YEAR
AND Date_Invoice__c <= TODAY
We are having one big Account which is not updating due to 1.5 lack of invoices. I wanted to update automatically with a trigger or a batch, please help me out.
The Account id is 001b000003ryQVMAA2 but I think it would be better with a custom label and not hard coded.
I am new in apex so it would be very helpful if someone would help me out.
Thanks a lot!!!