Introducing Validation Rules
Now that we’ve defined all the fields that we want on our Position object, let’s see if we can articulate a couple of rules about the data that should be entered into those fields. Even though the recruiters and hiring managers at Universal Containers are bright people, everyone sometimes makes mistakes when filling out a form, and a good app should catch the obvious errors.
For example, does it ever make sense for the value of the Min Pay field to be more than the value of the Max Pay field? Or should Close Date ever be unspecified if the Status field is set to Closed - Filled or Closed - Not Approved? Clearly not. We can catch these sorts of errors in our app with yet another built-in feature of the platform:
Get Force Platform Fundamentals: An Introduction to Custom Application Development in the Cloud now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.