I have the below scenario to achieve :

At the time of saving the Opportunity record, I want to invoke a webservice call to the external system. If the response of the call is greater than some value, then a opportunity record should be created else it should not be created. That is, I want to restrict the creation of the opportunity record based on the response of the webservice call.

As I understand, Salesforce can override only some specific standard buttons like New, View,Edit,Delete. However one cannot override the Save button.

Any suggestions on the approach will be useful.


2 Answers 2


You can replace the standard "New" and "Edit" pages by writing a Visualforce page and controller that uses the controller extension pattern. Then within the save method of the controller extension you can make the webservice callout and if it is successful call the standard controller's save method or otherwise output an error message.

However, this does mean replacing the layout-based standard opportunity page with your own hard-coded Visualforce page which is a step you may not want to take.


Did you tried writing a code in a before trigger of opportunity which calls your webservice method. And based on the response from webservice you can use "addError()" method in trigger to prevent the opportunity record from saving.

  • this solution can easily run into governor limits in a bulk update use case
    – cropredy
    Apr 17, 2016 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .