I have a custom object with many fields, I need to ensure some of these fields are required during update (but not insert). While I can create a validation rule for each of these required fields, I was wondering if I can combine them. The challenge when I combine them is that I cannot custom my message to identify which specific fields are missing. Is there a way to craft a single rule so that I can apply the violating value in the error message? Also, are there any performance or governance concerns if I create one validation per field. There are around 20 fields to check. Thanks.
3 Answers
Since validation rules can only have one message to present to the user, I think combining validation rules is a bad idea. If you are hitting your limit of validation rules on the object you can try asking Salesforce to increase that limit or you will need to turn to using triggers.
Alternatively, you can write a trigger and display an error with custom message - built based on your criterias for each field.
You can try to override the edit page with a custom visualforce page and controler that will check the user inputs. Then you can define custom error messages on the page, translate them and have a full control on what exactly is updated.
-
Keep in mind validation rules have a much wider scope than user input. Commented Aug 20, 2013 at 10:05