1

I need to be able to call an external web service to validate data being entered on a contact record before it is saved, and prevent the record being saved and display an error message to the user if that validation fails.

The best I've managed to find so far is to call an Apex trigger when the contact is modified, but as far as I understand it this runs asynchronously, so the contact would still be saved and any error message wouldn't be immediately obvious to the user.

Is what I'm trying to achieve possible?

1 Answer 1

3

I believe you cannot prevent saving a contact because triggers do not allow callouts to be made synchronously.

However you can give a UI to user(A custom visual force page with an extension) rather than a standard contact page and in the Ui, you can call your web service, validate data and choose whether to insert it or not on basis of validation.

You must log in to answer this question.

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