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
AAKAlanAAKAlan 

How to override, but not override?

Question about a salesforce.com button.

I have a highly customized activity.

It has a Save button (standard button)

I need to put in some Javascript validation/update code before the save of the current record executes.

 

How do I do this?

 

Is there some way to add the code to a Save button without destroying its save functionality?

 

Or should I create a custom Save button and hide the built-in Save Button. If this is the case, what syntax do I use to cause the new, unsaved page to save and update() the object?

 

Thank you. This is my first Salesforce button. I've done a lot of remote SOAP stuff with Salesforce, but this is my first time wrestling with the UI.

aalbertaalbert

The best way to customize the update action is to use Apex Triggers. Triggers reside in the data layer and not specifically in the UI. With a trigger, you can add additional logic "on insert" and/or "on update, for example. Then in the trigger logic, you can apply your logic and custom validation. If you need a custom UI aspect to this customization, you can implement a Visualforce page.