+ Start a Discussion

rollup of billing events per project



We've reached out limit of Rollups on our Project object. I need to code a roll up manually.


My goal is to calculate the total of all billing events per Project and update a field on Project called "Total Invoiced to Date". I'm trying to figure out the suedo code before I begin and would greatly appreciate any info more experienced coders can give. I believe it should look something like


trigger trg_RollupBillgEventsToProject on CCI_Invoice__c (after delete, after insert) {
	//CCI_Project__c is parent (record to be updated)
	//CCI_Invoice__c is the roll-up object (counting the total invoiced to date and adding them to the parent record)
	//Create a variable to hold the total of billing events associated with the project
	double dblTotalBillingEvents = 0;
	//CCI_Project__c is Parent (record to be updated)
	//CCI_Invoice__c is the roll-up object (counting the sum of Total_Invoice_Value__c in all billing events)
	//Create a new instance of the Project Object
	CCI_Project__c [] projectToUpdate = new CCI_Project__c[]{};
	//New Records
			for(CCI_Invoice__c be: childObjectNew ){

				!!! How would I collect the billing events? !!!!

				dblTotalBillingEvents += be.Total_Invoice_Value__c;

			projectToUpdate.Total_Invoiced_to_date = dblTotalBillingEvents;

 Above I'm trying to figure out the insert first, than I'll move on to updates and deletes.






Try the below link:-




Basically,you need a roll up summary trigger and the above link will show from scratch as how you can get it.


You could also contact Support to see if the Rollup Limit can be increased. Depending on the business case, they may be able to help out.