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
LuvaraLuvara 

Overriding the "Save" button for Opportunity Products

I have a few Opportunity Roll-up Summary fields that calculate off Opportunity Products. We'll call these ACV-New, PS-New and FC-New.

I also have three free form currency fields: ACV, PS, and FC. I want to keep reporting on the old fields, so I am copying the values from all the "-New" fields into the old legacy fields. The problem I'm having is that when you save the Opportunity products, the Roll-up Fields calculate, but it doesn't update the legacy fields with the new, calculated values. If you "Edit" and "Save" the Opportunity record it will then trigger the workflow to copy the values into the new field.

I've got an s-control that I think will work for opening, editing and then saving the opportunity record, and I'd like to trigger this off when a user clicks the "Save" button in the Opportunity Products. I can't find anyway to override the save button though... Any thoughts? Is there anyway I can do this with an Apex trigger? I would like to stray away from having some sort of "Refresh" or "Update" button that the user has to click.

Thanks in advance,

Chris

werewolfwerewolf
You can't override a save button.  Rather, you might want to look into writing a before insert or before update Apex trigger.  That will likely allow you to do what you're looking for.