Skip to main content
All,

I would appreciate some help on an Apex Trigger I am trying to create on Opportunities. I am kind of new in Apex trigger coding so I would really appreciate your help.

Below are objects with the following fields

Settlement__c

 (custom Object)

  • Recovery_Total__c  - Formula (Currency) field with formula -  Initial_Value__c - Book_Value__c 
Matter__c

(custom Object)

  • Total_Fees__c - Currency(16, 2) field 
Opportunities
  • Settlement_Recovery_Total__c - Currency(16, 2) field
  • Engagement_Total_Fees__c - Currency(16, 2) field 

There is a lookup relationship from Settlement__c  to Opportunities and another lookup relationship from Matter__c  to Opportunities.

What I was trying to figure out is how to sum the total records from the Total_Fees__c  field in Matter__c into the Settlement_Recovery_Total__c in Opportunities . Also sum the total records from the Recovery_Total__c  in Settlement__c  to the Settlement_Recovery_Total__c in Opportunities.

These total sums are for related records only between the objects.

Once this trigger is created, I will have a better understanding of creating other cross object triggers in the future.

I would really appreciate your help.
21 answers
0/9000