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
twrig15twrig15 

Create a trigger to rollup a value Opportunity from Product Object

Hello,

I'm totally new to triggers and have been trying to figure out how to create a Apex Trigger on the Opportunity object that looks at Product object that would return data based on custom number field.

For example:

1. If an Opportunity contains a product line that has a default value such as Standard Training Hours (Custom number field on Pricebook entry)  all the opportunity product line items that matches will popluate that field on the opportunity record. The custom field name to populate on the Opportunity record would be Total Training Hours.

2. Then I need to create another trigger on the Account object that if the opportunity has an "Active" Contract associated Opportunity to rollup sum the opportunity of all the Standard training hours from all opportunities that have a value in the Total # of Trainings Purchased.