You need to sign in to do that
Don't have an account?

Calling a class from a button
Hi All,
I want to add a button to the Opportunity Page that, when clicked, checks that certain fields have valid data.
If they don't, then I will display an error message.
If they do they I'll do something else.
So, is the right way to do this:
1) User clicks button which calls URL to a VF page
2) VF page calls the controller to check validation
3) If not valid, set errors on Opportunity and redirect user back to Opportunity page (somehow)
4) If valid, do the other action and send user back to Opportunity (somehow)
This feels wrong. For a start the VF page is purely there for calling the controller class and never actually displays anything.
What's the 'right' way to do this?
TIA
You'll need
Hope that helps!
Hi lnryan,
Thanks for your advice.
I'm afraid the last time I did one of these was using an s-control and you had to include the ajax libraries back then.
If I make my button and 'Onclick Javascript' button, how do I call the webservice without loading the AJAX libraries?
Thanks