I have a requirement in which I have to make a button, that first checks values of some fields and then, if conditions are true, redirects to a visualforce. Something like this:
if(field != value){
alert('error message')
}else{
//redirect to visualforce
}
This is for salesforce classic, so, normally, I would use onclick javascript for this. But, they asked to make it so it works for Lightning, BUT in the future, I mean, they wont migrate to Lightning right away. Is there a simple alternative to onclick javascript for classic that achieves this, and would work on lighting? I found a way in which I would create a "OnClickJSUtilityController" and implement an interface to perform the logic (source), but it seems a little too much for something so simple as to check a few fields.
Is there an alternative to this for classic? Thanks!