I have a custom button on a custom object, which redirected to a VF page via URL content source. But I only need to run it based on certain field value of my custom object. So without going to a VF page, can I run a validation to stop the process if the field value doesn't match?

Thanks, Lahiru


You can achieve this through ajax request below is sample code which validate contact fields.


if('{!Contact.Title}' == '' || '{!Contact.Phone}' == '' || '{!Contact.Email}' == ''}){
alert('Please populate Title. Email and Phone before procedding...');
window.location.href = <here you have to put the NEW Survey Page URL>;
  • Well the content source of the my button is URL. So how am I suppose to implement? Jan 18 '16 at 5:20
  • You can use execute JavaScript options. Google for the same u can get many resources.
    – MIX DML
    Jan 18 '16 at 5:43

Thanks For the Comments guys. I was able to do above validation using standard configurations, with record types. I simple create a new Record Type and assigned a Page Layout with NO custom button. And I have also implemented a WF Rule to set the new Record Type every time my criteria matches (regardless of Create/Edit). It works for me. Thanks for the help

  • 2
    Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From Review
    – martin
    Jan 18 '16 at 11:39
  • @martin this looks to me like the answers themselves didn't solve the users issue and this answer is how the user solved the issue.
    – Jenny B
    Jan 18 '16 at 18:10
  • @JennyB Yes you are correct Jan 19 '16 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.