No Code Date Validations

I've in the past had to write some... cludgey date comparisons. I'm not proud of them. I'm just glad I didn't have to look at them later.

Had I thought about what Mark Ragavan wrote about, it would have saved me probably days over my development time in the last 10 years.

Really, there's some common types of checks and actions for dates.

To show this I'll add some reproduction steps below. Start out with my ATF Scoped App;

  1. On your PDI import my "ATF" scoped app.
  2. URL:
  3. Change scope to "ATF"
  4. Goto maintain items, and look for "Test Item"

Now that you're here we can quickly test this out.

Disallow past dates

  1. Create a UI Policy with the condition, Date Before Today.

  1. Add a UI Policy action for the field Date and check the clear value checkbox.

  2. Update the variable Date to have Example text of "Date cannot be in the past."

Try it out.

Now that you've seen it, it should be pretty clear how to apply this to a number of different situations. I just wanted to share as this is a great way for me to remember.

Further Reading: No Code dates validations thru Catalog UI Policies