You need to sign in to do that
Don't have an account?
woodmanzee
Setting Apex Error Message on Detail Page from Custom Button
I have a custom button that currently checks the value in a field on a custom object and either displays a javascript alert if the field isn't what we want or redirects to a new page if the field is valid. I'd rather do it within salesforce rather than with an alert box - is there a way to add an Apex Error message at the top of the page? Or a smiliar method?
I am afraid if this is possible, you use validation though. Please refer following thred for validation:
http://salesforce.stackexchange.com/questions/8521/how-to-build-a-salesforce-custom-button-with-validation-rules
var error = document.getElementById('errorDiv_ep');
if (error == null) {
alert('Error: Invalid Status. The Work Order Status must be set to New, Open, or Scheduled to Cancel it.');
} else {
error.innerHTML = 'Error: (ERROR HERE).<br> (ERROR MESSAGE HERE)';
error.style.display='block';
}