0

I'm looking for help with a validation rule for controlling movement through opportunity stages, based on "key fields" (setup for path) being checked or not. Essentially I just need to check are boxes a &b &c all checked, if yes, allow saving into this opp stage; if not, of course throw an error. Here's what I have so far, and there has to be one simple thing I'm not getting. I'm getting it to throw the error, but when I check the field I also have it looking at, I'm still getting the error

ISPICKVAL( StageName ,"Proposal / Contract")&&All_Parties_Present__c = FALSE

I'll need to expand it to include two or three of those custom fields, like 'all parties present', but I figure once I get it working by validating one, it'll be easy to expand from there.

1
  • Welp, I made a mistake in this instance. I kept testing it using a different field, so of course I kept getting the error! Once I checked the 'all parties present' field, saved, no error. Now on to the follow up though, how do I add additional fields for it to check in an OR type scenario? As in: if All_Parties_Present__c OR Clinical_Acceptance__c are false, then throw the error. Oct 6 '18 at 17:41
2

Don't check multiple fields in a single validation rule. This makes the user experience more hostile, as they have to guess which fields must be selected instead of having the fields highlighted with an error message. You can have hundreds of validation rules on your object, so don't feel obligated to try and squeeze as much as you can in to a single rule.

3
  • in my example, the idea is for them to have checked the very specific fields/boxes, and those are the key fields setup for the path on the opportunity. I'm only saying this because they should know exactly what fields need to be selected/checked, as they're in the "key fields" section of the path. Are you suggesting I make a separate validation rule, so in my case about 25 of them, to check each field, rule by rule, to see if its checked in order to allow them to save it on the next opportunity stage? Thanks for your help! Oct 6 '18 at 22:45
  • @DevinPearman Yes, keep your validation rules on a per-field basis. Just because you have a Sales Path doesn't necessarily mean that everyone will be using it. The validation rules should make sense on their own, so that users can have a consistent experience everywhere, including mobile apps, etc.
    – sfdcfox
    Oct 6 '18 at 22:48
  • got it, I can do that. I'm still very new to the idea of validation rules, so the thought of having ~25 in place on one object at once seemed crazy to me! Thanks for the help, and I'll give it a shot later this evening. Oct 6 '18 at 23:05

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.